Tuesday, May 31, 2016

Protractor : How to implement XMLreports in protractor

In the post on how to automate web application using protractor we see that we ran the application and it just print test result at terminal window.

Here we see how we can implement Jasmine reporters. We will use xml reports.

In this post we will use our sample projects that was built in our previous post.

Step 1 : Open the project.

Step 2 :  Open Terminal window and install jasmine-reporters package using the following command.

npm install jasmine-reporters

 image

It installs two packages jasmine-reporters@2.1.1 and  mkdirp@0.3.5.

image

Step 3 : Now open config.js file and write the following script in onPrepare() function,

image

Here,

jasmine.getEnv().addReporter(): It create report after executing the script.

JUnitXmlReporter() : It generate XML report.

consolidateAll : Aggregate all the results. 

savePath: Report folder where report is generated. Use can define his own path.
filePrefix: Generated file name.

Step 4 : Now config.js file will look like the following,

image

Step 5 : Now open terminal window and run selenium server.

 image

Step 6 : Open another terminal window and run the script.

image

Step 7 : Note that script executes and report file is created at ‘testreport’ folder.

image

Now double click  to open the XML report and see the result. You can also open it through a browser.

image

That’s all for now.

In the next post we will see how we can generate HTML report.

Happy end to end testing using Protractor!!!

No comments:

Post a Comment

Cypress: How to handle browser-based authentication pop up dialog in Cypress

Five years ago I have written a blog on how to handle browser-based authentication for selenium webdriver.   Now it is for cypress. Cypress...