cucumber-reporting icon indicating copy to clipboard operation
cucumber-reporting copied to clipboard

Adding screenshots at the required steps

Open gogu1988 opened this issue 3 years ago • 2 comments

How to add screen shots at a gherkin step How to write extra info to a given gherkin step

gogu1988 avatar Feb 28 '21 18:02 gogu1988

Hi @gogu1988 , I'm not familiar with GittHub and issue management but open an issue may not be the best way to help you .. This is our code using Katalon Studio but you can find plenty of help more suitable to your setup

@After
public void cucumberAfter(Scenario scenario) {
	if(scenario.isFailed()) {
			println "teardown Tests cucumber isFailed"
			try {
				String filePath = WebUI.takeScreenshot()
				File file = new File(filePath)
				scenario.embed(Files.readAllBytes(file.toPath()), "image/png")
				}
			catch (Exception e) {
				println "screenshot exception : "+e.message
			}
	}
}

SolannP avatar Aug 10 '21 09:08 SolannP