may you inform me learn how to generate fairly html stories with screenshot ? After I run the take a look at the “cucumber-reports.html” doesn’t exist. Solely “picture.png” file is generated.
bundle cucumber.Choices;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(options="src/take a look at/java/options",
plugin = {"fairly", "html:goal/stories/cucumber-reports.html"},
glue= {"stepDefs"},
stepNotifications = true,
monochrome = true
)
public class TestRunner {
}
Technique that does screenshot
@After
public void afterTest(State of affairs state of affairs) throws IOException {
if (!state of affairs.isFailed()) {
// String vacation spot = System.getProperty("consumer.dir") + "//src" + "//Screenshots" + state of affairs + ".png";
last byte[] screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
state of affairs.connect(screenshot, "picture/png", state of affairs.getName());
String listing = System.getProperty("consumer.dir") + "//goal" + "//stories";
File sourceFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(sourceFile, new File(listing, "picture.png"));
}
if (driver != null) {
driver.give up();
}
}
pom file
4.0.0
org.instance
Cucumber
1.0-SNAPSHOT
11
11
UTF-8
org.seleniumhq.selenium
selenium-java
4.4.0
org.testng
testng
RELEASE
take a look at
io.cucumber
cucumber-java
7.8.1
io.cucumber
cucumber-junit
7.8.1
take a look at
junit
junit
4.12
compile
org.assertj
assertj-core
3.23.1
take a look at
io.github.bonigarcia
webdrivermanager
5.3.1
org.projectlombok
lombok
RELEASE
take a look at
org.reflections
reflections
0.9.11
com.google.guava
guava
31.1-jre
org.seleniumhq.selenium
selenium-java
4.8.3
org.projectlombok
lombok
1.18.26
compile
org.slf4j
slf4j-simple
2.0.7
take a look at
org.slf4j
slf4j-api
2.0.7
com.opencsv
opencsv
5.7.1
picocontainer
picocontainer
1.2
io.cucumber
cucumber-html
0.2.7
org.apache.maven.plugins
maven-surefire-plugin
3.0.0
io.cucumber
cucumber-core
7.11.2