Re: [rspec-users] RSpec Selenium Webdriver Html Report with Screenshots

2012-09-03 Thread Javix
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 Sunday, September 2, 2012 8:22:15 AM UTC+2, David Tishkoff wrote:

 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! 

 -- 
 Posted via http://www.ruby-forum.com/. 
 ___ 
 rspec-users mailing list 
 rspec...@rubyforge.org javascript: 
 http://rubyforge.org/mailman/listinfo/rspec-users 

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] RSpec Selenium Webdriver Html Report with Screenshots

2012-09-03 Thread Javix
You can generate HTML reports with surefire, just addd the folowing to your 
POM file:

plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-site-plugin/artifactId
version3.1/version
configuration
reportPlugins
plugin
groupIdorg.apache.maven.plugins/groupId

artifactIdmaven-surefire-report-plugin/artifactId
version2.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-report-plugin/ for 
reporting.

As for screen shots, see takeScreenShot class in Selenium API: 
http://selenium.googlecode.com/svn/trunk/docs/api/java/index.html?overview-summary.html

On Sunday, September 2, 2012 8:22:15 AM UTC+2, David Tishkoff wrote:

 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! 

 -- 
 Posted via http://www.ruby-forum.com/. 
 ___ 
 rspec-users mailing list 
 rspec...@rubyforge.org javascript: 
 http://rubyforge.org/mailman/listinfo/rspec-users 

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] RSpec Selenium Webdriver Html Report with Screenshots

2012-09-03 Thread David Tishkoff
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.

-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users