Saturday, January 26, 2019

Post 2: Attaching Screenshot to failed tests in ExtentReports Version 4

In Post 1 we have learned generating the extent reports using ExtentReportsV4, in this postwe will learn about adding the screenshot to failed test cases. This will be continuation to Post 1, please go through it first then continue this.

Step 1: Update the pom.xml with Apache Commons IO dependency, as shown below. This required to copy the files.

Step 2: Now write a function in base class, that takes the screenshot and returns the path of the screenshot.

Step 3: We will call this function in @AfterMethod, this function will be invoked only when test failed.

Then using "addScreenCaptureFromPath(String path)" method of extent reports, the screenshot will be attached to the test in the extent report.

Check below, the screenshot is attached to failed test case.



#HappyLearning #HappyTesting

3 comments:

Katalon 08: Integration of HP ALM with Katalon Studio

In this post, this post we discuss about integration of  HP ALM with Katalon Studio. If we can integrate HP ALM with Katalon we can update ...