jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Continuum
  • CONTINUUM-2268

Continuum Webapp Tests Capture Screenshot for AbstractSeleniumTest.java

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Test Test
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.4.0 (Beta)
  • Component/s: Testing
  • Labels:
    None
  • Environment:
    Linux
  • Complexity:
    Intermediate
  • Patch Submitted:
    Yes

Description

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

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    CaptureScreenshotForAbstractSeleniumTest.patch
    16/Jun/09 11:37 PM
    11 kB
    Bernard Lago
  2. Text File
    ContinuumTestCaptureAssertionError.patch
    16/Jun/09 4:26 AM
    11 kB
    Bernard Lago

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Bernard Lago added a comment - 16/Jun/09 11:37 PM

Please disregard the first attachment and use CaptureScreenshotForAbstractSeleniumTest.patch
Minor code changes were made to this new one.

Additional Info:
Patch created at revision 785468

Results :

Tests run: 167, Failures: 0, Errors: 0, Skipped: 0

[INFO] [cargo:stop {execution: stop-container}]
[INFO] [install:install]
[INFO] Installing /home/blago/Documents/apache/continuum/trunk/continuum-webapp-test/pom.xml to /home/blago/.m2/repository/org/apache/continuum/continuum-webapp-test/1.4.0-SNAPSHOT/continuum-webapp-test-1.4.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23 minutes 21 seconds
[INFO] Finished at: Wed Jun 17 12:05:44 GMT+08:00 2009
[INFO] Final Memory: 32M/113M
[INFO] ------------------------------------------------------------------------

Show
Bernard Lago added a comment - 16/Jun/09 11:37 PM Please disregard the first attachment and use CaptureScreenshotForAbstractSeleniumTest.patch Minor code changes were made to this new one. Additional Info: Patch created at revision 785468 Results : Tests run: 167, Failures: 0, Errors: 0, Skipped: 0 [INFO] [cargo:stop {execution: stop-container}] [INFO] [install:install] [INFO] Installing /home/blago/Documents/apache/continuum/trunk/continuum-webapp-test/pom.xml to /home/blago/.m2/repository/org/apache/continuum/continuum-webapp-test/1.4.0-SNAPSHOT/continuum-webapp-test-1.4.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 23 minutes 21 seconds [INFO] Finished at: Wed Jun 17 12:05:44 GMT+08:00 2009 [INFO] Final Memory: 32M/113M [INFO] ------------------------------------------------------------------------
Hide
Permalink
Wendy Smoak added a comment - 17/Jun/09 5:34 PM

Thanks, Bernard, this is really neat! Applied on trunk r785845

I'm leaving the issue open for documentation, src/site/apt/index.apt (or a another page if that gets too long) needs to talk about this.

Show
Wendy Smoak added a comment - 17/Jun/09 5:34 PM Thanks, Bernard, this is really neat! Applied on trunk r785845 I'm leaving the issue open for documentation, src/site/apt/index.apt (or a another page if that gets too long) needs to talk about this.
Hide
Permalink
Jose Morales Martinez added a comment - 21/Jun/09 5:30 AM

It's good idea.

I am searching information about logs inTestNG and I think we can replace try/catch in AbstractSeleniumTest for TestNG listeners [1] and then we take screenshot. What do you think about it?

[1] http://testng.org/doc/documentation-main.html#logging-listeners.

Show
Jose Morales Martinez added a comment - 21/Jun/09 5:30 AM It's good idea. I am searching information about logs inTestNG and I think we can replace try/catch in AbstractSeleniumTest for TestNG listeners [1] and then we take screenshot. What do you think about it? [1] http://testng.org/doc/documentation-main.html#logging-listeners.
Hide
Permalink
Jose Morales Martinez added a comment - 21/Jun/09 1:11 PM

I will change filename format because use ':' and this character is not allowed in filename for Windows.

Show
Jose Morales Martinez added a comment - 21/Jun/09 1:11 PM I will change filename format because use ':' and this character is not allowed in filename for Windows.
Hide
Permalink
Bernard Lago added a comment - 21/Jun/09 9:23 PM

Thanks for pointing out the use of ":"
I haven't tried this on a windows box. Please do the necessary changes. Thanks again!
Still reading about the TestNG Listeners. I will try it out and see if it will work.

Show
Bernard Lago added a comment - 21/Jun/09 9:23 PM Thanks for pointing out the use of ":" I haven't tried this on a windows box. Please do the necessary changes. Thanks again! Still reading about the TestNG Listeners. I will try it out and see if it will work.
Hide
Permalink
Bernard Lago added a comment - 23/Jun/09 12:39 AM - edited

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

Show
Bernard Lago added a comment - 23/Jun/09 12:39 AM - edited 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
Hide
Permalink
Jose Morales Martinez added a comment - 23/Jun/09 8:05 PM

Fixed in 787880r.

I declare listener CaptureScreenShotsListener in pom and move capture process to this listener. I delete try/catch from selenium class.

I think this issue is finished.

Thank Bernard.

Show
Jose Morales Martinez added a comment - 23/Jun/09 8:05 PM Fixed in 787880r. I declare listener CaptureScreenShotsListener in pom and move capture process to this listener. I delete try/catch from selenium class. I think this issue is finished. Thank Bernard.

People

  • Assignee:
    Jose Morales Martinez
    Reporter:
    Bernard Lago
Vote (0)
Watch (0)

Dates

  • Created:
    16/Jun/09 4:26 AM
    Updated:
    23/Jun/09 8:05 PM
    Resolved:
    23/Jun/09 8:05 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.