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.
Jasmine is the framework that does the spec reporting, not Protractor. You can either use one of the popular ones they already have:
(1) https://www.npmjs.com/package/jasmine-spec-reporter
(2)https://github.com/larrymyers/jasmine-reporters (look at the JUnit XML section)
Or you can make your own (which is what it sounds like you want): http://jasmine.github.io/2.1/custom_reporter.html
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:
If you need any suggestions/help, please ping here, i'm happy to help you.
Change your
conf.js
file something like this.Then execute it using following comander.
Feel free to ask any questions if you are not clear. :)