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.
I did exact settings above and executed below command "npm run protractor -TESTED=testcaseone".
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.
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:
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With