jeudi 9 mai 2019

extentreports-testng-adapter how to generate HTML report having screenshot attached if test failed (cucumber, testng))

I am using a framework which is built using cucumber, selenium, testng and maven.

Maven for dependencies only.

Testng for execution the cucumber feature files using AbstractTestNGCucumberTests.

I have also implemented the Extent Report using extentreports-testng-adapter. see this link that I referred - http://extentreports.com/docs/versions/4/java/testng.html

I have added both extent.properties file and html-config file and my report is properly generating.

Now, only problem is I dont know how to attach the screen shot with the report if my cucumber scenario fails with the above setup.

Note : I have not added any code anywhere for extent report as the above library (extentreports-testng-adapter) covers it. Also I have used the above setup because I have to run my test parallel hence cant use static built in methods.

code : @CucumberOptions(features = { "src/test/resources/common_features/test.feature" }, glue = { "com.step.definitions" }, tags = {}, plugin = {}, monochrome = true, dryRun = false

)

@Listeners({ExtentITestListenerAdapter.class}) public class TestCase extends AbstractTestNGCucumberTests {

Thank you for the help.

Aucun commentaire:

Enregistrer un commentaire