Testing Video

Any advice on testing video?

I have an application where a video starts on launch. I need to confirm that the video is running. I then need to confirm that it pauses when a pause button is clicked, unpause when play is clicked, mutes when mute is clicked and unmutes when unmute is clicked. Any thoughts?

Thanks.

Comments

  • looks like a good bit of planning is going to be needed.

    I would say that just looking for a button down condition for pause/play mute/unmute would leave you open for some errors.

    I'd use a video test file with alternating dots and squares say five seconds of each, check for the condition for an image match on screen after you believe the pause has been executed, then check a few more times over a fivev second period to determine if the image has actually paused ( you'll look for the image not found when checked).

    the sound is a bit tricky actually, since the typical UI that can determine if sound is playing is human.

    Depending on your platform, a sound recording program that monitors the sound out port that could show the output activity in wave form could tell you if the audio was flatlining or now when you clicked on the mute.

    Certainly "do" able with eggplant.

    Sounds like a fun project, you'll want to bone up a bid on image matching and prepare a proper video test file before starting.

    good luck!
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Good response, Mr. "P" !

    Everything Mr. "P" said is generally good advice. Providing a special test video with slow frames as he suggested could simplify your testing (they wouldn't need to be as slow as 5 seconds each, but the basic idea is a good one). But if you can't control the video, here's another idea, using dynamically captured images:

    To tell that a video is playing, have your script capture an image of the video playback region, then look for that image a moment later and verify that it's no longer showing in that region of the screen. The script to do this might look something like this:
    set videoRegion to (imageLocation("videoTopLeft"), imageLocation("videoBottomRight"))
    set videoImagePath to "/tmp/videoImage.tiff"
    -- capture an image of the playing video:
    captureScreen (rectangle:videoRegion, name:videoImagePath)
    -- wait briefly and check that the video region looks different:
    wait 1/4 second
    if imageFound(0,(image:videoImagePath, searchRectangle:videoRegion))
        logWarning "Video doesn't seem to be playing"
    end if
    
    You could repeat this a few times to verify that the video continues to play, if you like.

    To test the pause button, you could click "Pause", then capture the paused video image and verify that you can find it again.

    Dynamically capturing images in your script and then searching for them isn't a technique that's needed very often in Eggplant, but for situations like this it can be very useful.
  • SenseTalkDoug -

    I love your idea! One small problem. The video will be shown in a web browser so I can't guarantee that the video will be see at the same screen coordinates every time. This makes imageLocation hard to use since we need the screen coordinates (right?)

    The bottom right of the video has play/pause and mute/unmute buttons. I can get the coordinates of that corner by doing an image location on them. Is there a way to subtract from these coordinates so I can calculate a top right corner?
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Absolutely! Coordinate calculations are simple, for example:
    set topLeftCorner to imageLocation("bottomRightImage") - (400,300)
    
    In most cases you probably don't even need to do that, though. Just remember that the HotSpot of an image can be set anywhere in relation to that image. So you may be able to capture one image of the controls (the Play button, for instance) with the HotSpot set to the bottom right corner of the video area, and another captured with the HotSpot set to the top left corner. That way you don't need to worry about coordinates at all.
  • The coordinates returned by imageLocation are the coordinates of the HotSpot (where the crosshairs are when you capture the image)?
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    Yes, that's correct. Whenever Eggplant finds an image, the coordinates returned are those of the image's HotSpot.
  • I just implemented this but get an error when trying to capture the image.

    Tue, 4/29/08 10:21:06 AM capturescreen /tmp/videoImage.tiff (206,236,934,326)
    Tue, 4/29/08 10:21:06 AM imagefound Unable to Find Image ("/tmp/videoImage.tiff") within 0.00 seconds

    Apparently it can't compare the image.
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    The output you showed is just what would be expected when the video is playing. If you're getting that output when the video is NOT playing, it's probably because you copied the sample code that I posted! Ah, the dangers of posting code without actually trying it... :oops:

    I've tried it now and seen the problem. First I'll give the solution, and then explain what's happening. To fix the script, add any command that interacts with the SUT before the CaptureScreen command. I added the following line before capturing the screen:
    moveTo (100,100)
    
    When used in a normal script you probably won't even need that, since the script will be interacting with the SUT prior to capturing the screen, but the example I posted didn't do that, so adding a moveTo is harmless, and does the trick. Here's what's happening:

    It seems that we do some clever things in the CaptureScreen command to make it possible for a script to capture the screen in an error-handling routine and get a picture of what the screen looked like when the error occurred, rather than what it may actually look like at the present time. Eggplant actually keeps a picture of the screen from the last time that a search failed, and captures from that image. This feature can be very helpful for evaluating the cause of an error, but is causing trouble in this case. Executing any SUT-related command (like MoveTo) resets Eggplant to a non-failure state, so CaptureScreen will capture an image based on the present state of the SUT rather than one remembered from the past!

    I hope that clears things up for you.
  • How to play a video file using eggPlant script?
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    To play a video on the SUT is no different than any other task: simply script the user actions (button clicks, typing, etc.) that a user would perform to start the video playing.
  • Yes.I can understand.But I need to know is there a function or command available to play a video in a specific location?
  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    EggPlant doesn't have a function to play video, it only performs user actions on the SUT. So whether you can cause the video to play at a particular location on the screen depends entirely on the video player you are controlling on the SUT. For most programs I think it would just be a matter of dragging the playback window to the desired location, but you'll have to look at the program you're using and decide whether it's possible and how to do it.
Sign In or Register to comment.