Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customize the protractor test report/output

Tags:

protractor

Hi I'm trying to get the protractor test results in a file by giving the following command in command prompt. protractor conf.js > location\result.txt where I could see the complete output of the protractor test.

Can I get just the number of Specs executed and failures in a txt file after running the protractor tests in a customized way?

I need my report in this customized way as I need to run a shell script if all the protractor tests are passed.

like image 862
Sin Avatar asked May 02 '16 14:05

Sin


People also ask

Which command is used to run the protractor test cases in command prompt?

I did exact settings above and executed below command "npm run protractor -TESTED=testcaseone".

How do you run the same test multiple times in protractor?

When you want to run protractor scripts by opening a browser instance for each test, you should add two capabilities shardTestFiles and maxInstances in the Capabilities block of the conf. js file. This will help to execute your scripts on same browser with multiple instances.


1 Answers

We have two ways to fulfill your requirement. but it will give final results in .json format. If you really needed only .txt format you convert .json to .text

Ways To Do:

  1. Declare parameter 'resultJsonOutputFile:' value in conf.js file as follows-

    resultJsonOutputFile:'./testResults.json', //output file path to store the final results in .json format

OR

  1. Pass the output file path from command line while running the protractor:

    Command:

      protractor --resultJsonOutputFile='../outputFilePath.json' protractor.conf.js
    

If you need any suggestions/help, please ping here, i'm happy to help you.

like image 159
Optimworks Avatar answered Oct 01 '22 01:10

Optimworks