Hello, I'm using Rake + RSpec + Selenium-WebDriver for the web testing, Is there a way to create html report with the screenshot generated on failure? Would really appreciate your help!
on 2012-09-02 08:20
on 2012-09-03 13:59
You can generate HTML reports with surefire, just addd the folowing to
your
POM file:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.1</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.4.3</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
See more details on its use at
http://maven.apache.org/plugins/maven-surefire-plugin/
adn http://maven.apache.org/plugins/maven-surefire-rep... for
reporting.
As for screen shots, see takeScreenShot class in Selenium API:
http://selenium.googlecode.com/svn/trunk/docs/api/...
on 2012-09-03 14:00
Just a piecec pf code to create a screen shot:
private void takeScreenShot(RuntimeException e, String fileName) {
File screenShot = ((TakesScreenshot)
driver).getScreenshotAs(OutputType.FILE);
try {
FileUtils.copyFile(screenShot, new File(fileName + ".png"));
} catch (IOException ioe) {
throw new RuntimeException(ioe.getMessage(), ioe);
}
throw e;
}
on 2012-09-03 19:59
Serguei Cambour wrote in post #1074435: > Just a piecec pf code to create a screen shot: > > private void takeScreenShot(RuntimeException e, String fileName) { > > File screenShot = ((TakesScreenshot) > driver).getScreenshotAs(OutputType.FILE); > > try { > > FileUtils.copyFile(screenShot, new File(fileName + ".png")); > > } catch (IOException ioe) { > > throw new RuntimeException(ioe.getMessage(), ioe); > > } > > throw e; > > } Thank you for the help, sorry I forgot to mention that I'm using ruby and I need screenshots to be included into RSpec html reports.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.