VideoRecorder Extension for TestComplete
This extension enables you to record videos for your automated tests running in SmartBear TestComplete or TestExecute.
The extension adds the
VideoRecorder script object for starting and stopping video recording from your script tests, and the Start and Stop Video Recording keyword-test operations for doing this from keyword tests.
The extension uses JScript sources, but it is suitable for any supported scripting language.
It records a video for your test runs, helping you to check the test execution and to understand what happened in your system and in the tested application during the test run.
VideoRecorder is similar to Test Visualizer of TestComplete, but it provides more convenient results. While Test Visualizer captures images for test commands that simulate user actions, VideoRecorder creates a movie reflecting all the events, including those that occur between two commands. Also, it is easier to analyze a seamless video clip than a series of screenshots.
When to Use
Use VideoRecorder when it is difficult to understand the cause of an issue during automated test runs. For example, in some cases, it is really difficult to find the cause of issues that occur during nightly test runs. Videos can help you with this.
Note that videos can occupy a lot of space on your hard drive. Also, long videos may be inconvenient for analysis in comparison with short video clips. That is why we do not recommend that you record a video for the entire nightly test run. Do this for problematic areas only. You can easily achieve this by adding the Start and Stop Video Recording commands to the appropriate places in your tests (see below).
Video Recorder Engine
The extension uses the recording functionality of the free, open-source VLC media player by VideoLAN. You can download it from https://www.videolan.org/.
1. Install the VLC Media Player
- Download the VLC installer from https://www.videolan.org/.
- Install the VLC media player on your computer. The installation is straight-forward. Just follow the instructions of the installation wizard.
2. Get the Extension
- Clone the repository to your computer.
- Open the command-line window and run the
build.batfile located in the repository root folder. It will pack the extension sources to the
VideoRecorder.tcxarchive and copy the archive to the
outsubfolder of your repo.
3. Install the Extension
- Close TestComplete (or TestExecute).
- Copy the file VideoRecorder.tcx from the
outsubfolder to the
Bin\Extensions\ScriptExtensions\folder of your TestComplete or TestExecute installation, for example:
C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\Extensions\ScriptExtensions
C:\Program Files (x86)\SmartBear\TestExecute 12\Bin\Extensions\ScriptExtensions
Now you can launch the product and use the extension as you want.
Using Video Recorder
You can start and stop recording from your script or keyword tests.
In Keyword Tests
To start and stop recording, you use the Start Video Recording and Stop Video Recording operations which VideoRecorder adds to TestComplete. You can find these operations in the Logging operation category. Simply drag these operations to your test:
That's all. Now you can run your test.
To work with the recorder from scripts, the extension adds the
VideoRecorder object to TestComplete. The object is available in all the supported scripting languages.
VideoRecorder.Start() method to start recording, and
VideoRecorder.Stop() to stop it. The
Start() method has the VideoQuality string parameter (
Start(VideoQuality)) that specifies the quality of the recorded video. Possible values include "Low", "Normal" (default) and "High". The parameter is case-insensitive. The other two parameters are also optional: sPath - an optional string path to output folder, sName - an optional file name, do not use extension.
To determine if the recorder is working, use the
During its work, the recorder posts informative, warning and error messages to the test log.
Information on the recorded file name is available in the test log in both the "start" and "stop" messages. You can find the file name on the Additional Info tab:
The link to the recorded video is posted along with the "stop" message. The "start" message does not contain it, because the file does not exist at the moment of the start.
The recorder generates the video file when the recording stops or when TestComplete exits. If your test stops on error, then it is possible the execution flow will not reach the "stop" command and it will not be executed. For more information on this issue and for possible workarounds, see below.
- The recorder always captures the entire screen.
- On systems with multiple display devices, it records the main display only.
- The video format is
- The size of the resulting movie depends on how long the video was recorded, on its quality (low, normal, or high) and on your screen resolution.
- The video file name includes the date and time of the start of video recording, so you can record several videos during one test run.
- If generation of the resulting video file takes longer than 10 minutes, the extension cancels this process, stops the recording engine and reports an error.
- The keyword-test operations and the
Stopscripting methods return the fully-qualified name of the recorded video file.
- IMPORTANT: start and stop recording from within your test. The extension cannot use the recorder instance started outside TestComplete (or outside TestExecute). Also, it is very important to stop the recorder when the testing is over. The extension cannot start recording if you have a working recorder instance in the system. In this case, you have to close the recorder process (or processes) manually.
If Your Test Stops on Error
This can happen rather frequently. For example, if the Stop on Error property of your project is enabled, the test engine stops the test run once an error is posted to the log. In this case, it is possible the recorder will not be stopped because the test will not reach the "Stop" command.
Consider adding another "Stop Video Recording" command to the
OnStopTestevent handler. That is, you will have two "Stop" commands: one in the place where you need to stop recording, and another in the OnStopTest event handler. This event is raised whenever the test execution stops, so placing the "Stop" command there can be a good idea. Note that it is important to check if the recorder is running before calling
Consider adding the
/e) argument to the TestComplete (or TestExecute) command line. In this case, when the test stops on error, the test engine will close TestComplete (TestExecute). The extension will detect this and will generate a video file. To find the file name, check the Additional Info posted to the log along with the "start" log message.
Consider disabling the Stop on Error project property. See Project Properties - Playback Options in TestComplete documentation.
We have tested the extension on --
- TestComplete 12.40, TestComplete 12.50
- VLC media player 2.2.6, VLC media player 3.0.1
Most likely, the extension will work with other TestComplete and VLC versions.
Contacts and Feedback
To learn more about the extension, please visit the TestComplete Community forum.
Do not hesitate to send your questions, comments, bug reports and suggestions to the forum. We appreciate any feedback.
If you want to improve or fix code, feel free to send pull requests to this repo.