#9 Record Playback

open
nobody
None
5
2012-12-04
2004-09-22
Joe Cole
No

I wish to be able to take screenshots at certain points
in the test scripts or take screenshots at every change.

This should be a relatively minor enhancement with
java.awt.Robot classes.

The screenshots could be taken and put in a directory
structure (by default) like this:

TestRunNumber/Screenshots/TestName/1.png
TestRunNumber/Screenshots/TestName/2.png
TestRunNumber/Screenshots/TestName/....png
TestRunNumber/Screenshots/TestName/n.png

This would be very useful for automatically generating
screenshots for documentation.

The call could simply be:

screenshot(); // which would use the default directory
format

or

screenshot("specific file path"); // which would put it to
a user specified file.

Discussion

  • Dakshinamurthy Karra

    Logged In: YES
    user_id=156777

    Looks like a good feature to have. I would like to enhance
    it to Marathon to (optionally) automatically capture the
    screen shot if any of the test cases fail in batch mode. I
    will close this issue once that is done.
    For the time being you can use the following function (Power
    of Jython at play:). Just drop the following function into
    the testcase where you want the screenshot to be taken and
    pass a file name as a parameter.

    ===>def screenshot(fileName):
    from java.awt import Robot
    from java.awt import Toolkit
    from java.awt import Rectangle
    from javax.imageio import ImageIO
    from java.io import File
    ImageIO.write(Robot().createScreenCapture(
    Rectangle(Toolkit.getDefaultToolkit().getScreenSize())),
    "png",
    File(fileName))

    ==>

    Please format it to make python happy.

    Thanks and Regards
    KD

     
  • Dakshinamurthy Karra

    Logged In: YES
    user_id=156777

    I spoke to few of our test engineers and they felt that
    taking screen shot in case of failed tests is of no great
    value. Hence, I am dropping that feature.
    If anyone feels a need for that feature, please feel free to
    open a feature request.
    The screenshot() function will be part of the next release.
    For the benefit of creating unique file names, the testcase
    name and package names will be made available to the test
    scripts.

     
  • demotivator

    demotivator - 2007-10-26

    Logged In: YES
    user_id=1650915
    Originator: NO

    I submitted a patch for screenshots recently, and then just noticed this RFE. In my version I required the file path be specified, though an automatic convention like you suggest wouldn't be too hard to add.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks