Set report / exit of exposure test

Hey. I am trying to get protractor test results in a file by providing the following command on the command line. protractor conf.js> location \ result.txt where I could see the full protractor test output.

Can I get only the number of Specs performed and crashes in the txt file after running the transport tests separately?

I need my report in this custom form, since I need to run the shell script if all the transporter tests pass.

+6
source share
3 answers

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

Ways to do:

  • Declare the resultJsonOutputFile: 'parameter in conf.js as follows:

    resultJsonOutputFile: './testResults.json',// print the path to the file for storing the final results in .json format

OR

  1. Pass the path of the output file from the command line when starting the protractor:

    Team:

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

If you need any suggestions / help, please ping here, I am happy to help you.

+6
source

Jasmine is a frame that reports on a specification, not a protractor. You can use one of the popular ones that they already have:

(1) https://www.npmjs.com/package/jasmine-spec-reporter

(2) https://github.com/larrymyers/jasmine-reporters (see XML JUnit section)

Or you can make your own (this is what you think): http://jasmine.imtqy.com/2.1/custom_reporter.html

+4
source

Change the conf.js file something like this.

 var HtmlReporter = require('protractor-html-screenshot-reporter'); var reporter = new HtmlReporter({ baseDirectory: './protractor-result', // a location to store screen shots. docTitle: 'Protractor Demo Reporter', docName: 'protractor-demo-tests-report.html' }); exports.config = { framework: 'jasmine', seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['invoice.js'], capabilities: { browserName: 'chrome', }, jasmineNodeOpts: { showColors: true, // Use colors in the command line report. }, onPrepare: function() { jasmine.getEnv().addReporter(reporter); } } 

Then execute it using the following commander.

 npm install protractor-html-screenshot-reporter 

Feel free to ask any questions if you do not understand. :)

+1
source

All Articles