Test report for Rest Assured

Reading Time: 3 minutes

Test report is generally a communication bridge between test manager and stakeholder. The stakeholder can understand the project situation with test report only. One of the use case will be evaluating the quality using test report. It is because you want to make decisions based on those reports for example if there are number of defects remaining the project, we simply not release the project.
We will use HTML test report for Rest Assured. Test report is a document which contains:

  • A summary of test activities and final test results
  • An assessment of how well testing is performed

Rest assured is a java based tool used for automating Restful web services. It is a powerful behavior driven library set up for testing out various API endpoints and their response bodies. It helps in writing readable, maintainable tests for RESTful APIs. Rest assured can be integrated to use either TestNG or Junit frameworks to write test cases and for the shake of the simplicity we will be using TestNG framework here.

Don’t worry if you don’t have any idea about what TestNG is, you can have a bird’s eye view on it via this blog post. Use testNG.xml to execute the test cases. Once you execute the test cases its will generate default test report.

This is how our test script will look like :

This what a testNG.xml file be like :

After executing those test cases just refresh your project, you will then get emailable-report.html which is out test report. Here is the project structure and the path to reach this file.

The name is emailable-report.html because it will generate a standard report which is generally expected by stakeholder. And this gives us another reason why to use rest assured instead of any other framework.

At the end just open that html report with what ever browser you like. It give you information like number of test cases passed, failed and skipped. Total execution time with number of groups excluded or included. There will be a separate section in the reports which shows execution time for each test cases.

Hope you like my blog on test report for Rest Assured and let me know you views in the comment section below.

References : https://reportng.uncommons.org/


Knoldus-blog-footer-image

Written by 

Alok Jha is the QA Consultant at Knoldus Software LLP. He has good knowledge of languages Java, Java 8, Rust and JavaScript. As a QA, he always tries to explore the different type of software and tools.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading