What failed? Everything you need on your test reports

Protractor is a tool used for testing end-to-end. Protractor tests simulate user interaction in a real browser

Are you looking for testing tools? Protractor is a tool used for testing end-to-end. Protractor tests simulate user interaction in a real browser and compare them against the expected results. We will show you two ways to generate reports on the results of the tests.

Prerequisites

Having our project up and running with Karma and Protractor, it is necessary to install the Jasmine Reporters plugin to add different reporters to our tests. We add the following to the packsage.json:

And we add the onPrepare function to the proctractor.conf.fs:

Junit

Karma Junit Reporter is a plugin for generating reports in Junit format. The advantage of generating reports in this format is that there are many tools that support it and can use them to perform tasks according to their results; for example, Jenkins . To install it, we add the dependency on package.json:

And we add it to the reports onto the onPrepare of protractor.conf.js:

The first parameter is the directory where we will generate the reports and the last one, the prefix to use for the generated files.

Screenshots

Protractor HTML Screenshot Reporter generates screenshots of each test and displays them in an HTML report. To configure it, add the dependency:

And we add it to the Jasmine’s reporters:

Again, we pass the parameter through the directory where the report and screenshots will generated.

After running the tests, the main HTML remains in test-results / e2e-screenshots / reporter.html.

Share this articleShare on LinkedInTweet about this on TwitterShare on FacebookShare on Google+Email this to someone
Go Back