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


Java Program 6: How to reverse a String in Java?

In this post we will discuss different methods to reverse a String in java programming. Method 1: Step 1: Read the input string using ...