You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@continuum.apache.org by "Bernard Lago (JIRA)" <ji...@codehaus.org> on 2009/06/23 07:40:15 UTC

[jira] Issue Comment Edited: (CONTINUUM-2268) Continuum Webapp Tests Capture Screenshot for AbstractSeleniumTest.java

    [ http://jira.codehaus.org/browse/CONTINUUM-2268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=181182#action_181182 ] 

Bernard Lago edited comment on CONTINUUM-2268 at 6/23/09 12:39 AM:
-------------------------------------------------------------------

Jose,

I tried the example from the link you posted about TestNG Listeners.
I created a class that subclasses TestListenerAdapter and created a method that will be called for every test failure. I also modified pom.xml's maven-surefire-plugin to use the new Listener class.
For the said method, I am having issues creating the selenium object that will call the captureEntirePageScreenshot method. If I create a new selenium object, then I will have to pass another set of parameters. (url, browser, etc) and it would be like calling the open() method of AbstractSeleniumTest class again. 
It seems complicated to use this inside the Listener class. A possible workaround is to write a new capture screenshot method inside the Listener class and not use selenium's capture method. (btw, I prefer using selenium's capture method)
Maybe you can suggest how to implement this using Listeners.

Bernard




      was (Author: blago):
    Jose,

I tried the example from the link you posted about TestNG Listeners.
I created a class that subclasses TestListenerAdapter and created a method that will be called for every test failure. I also modified pom.xml's maven-surefire-plugin to use the new Listener class.
For the said method, I am having issues creating the selenium object that will call the captureEntirePageScreenshot method. If I create a new selenium object, then I will have to pass another set of parameters. (url, browser, etc) and it would be like calling the open() method of AbstractSeleniumTest class again. 
It seems complicated to use this inside the Listener class. A possible workaround is to write a new capture screenshot method inside the Listener class and not use selenium's capture method. (btw, I prefer using selenium's capture method)
Maybe you can suggest how to implement this using Listeners.

- Bernard



  
> Continuum Webapp Tests Capture Screenshot for AbstractSeleniumTest.java
> -----------------------------------------------------------------------
>
>                 Key: CONTINUUM-2268
>                 URL: http://jira.codehaus.org/browse/CONTINUUM-2268
>             Project: Continuum
>          Issue Type: Test
>          Components: Testing
>         Environment: Linux
>            Reporter: Bernard Lago
>         Attachments: CaptureScreenshotForAbstractSeleniumTest.patch, ContinuumTestCaptureAssertionError.patch
>
>
> The attached patch includes the following changes:
> Changed continuum-webapp-tests/pom.xml selenium version from 0.9.2 to 1.0.1
> Added a captureEntirePageScreenshot to AbstractSeleniumTest.java
> Added a catch block for every failed assertion to do a screen capture and save them to target/screenshots directory
> Formatted the filename of the captured file as "methodName(className.java:lineNumber)-time.png"
> Additional Info:
> Maven version: 2.0.10
> Java version: 1.5.0_16
> OS name: "linux" version: "2.6.27-14-generic" arch: "i386" Family: "unix"
> Patch created at revision 785116.
> Build Results:
> Results :
> Tests run: 167, Failures: 0, Errors: 0, Skipped: 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira