Features
< Back to Blog Overview

Record video of your Selenium Tests

2011-12-19
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews

We have just finished optimizing the video recording in our Selenium grid. Implementing this was harder than we thought, so here are some tips on how we implemented this.


To create a video, we used AForge's AviWriter, which makes creating avi videos very easy in C#. We first started off with using C# and Windows' PrintWindow function. This worked in some cases but would sometimes show a dark square in the content area. PrintWindow was also very slow when appending it to a video.


Next, we tried to use Bitblt and GDI with C#, together with AviWriter. This was still too slow for us as it caused tests to run twice as long. We want your tests to run as fast as possible and did not want to hog the CPU because of video recording.


After searching on Google, we found several costly screen capture SDKs which promised fast video recording by using special drivers. This turned out to be working in some cases, but was still too slow.


Finally, we investigated Microsoft Expression Encoder which offers a screen-capture SDK. This turned out to be a winner since it recorded video without hogging the CPU. The only pitfall is that the video encoding used by this SDK is a proprietary encoding by Windows. To convert the video to FLV, we needed to encode it after recording, something that requires quite a lot of CPU.


We choose to do the video recording on a different high CPU server, so that your tests will run as fast as possible without a screen recording slowing down the CPU.


The program we're using to take screenshots is MiniCap, which is a lightweight command line program to easily take screenshots. Highly recommended.


It was quite a journey, but we think we now have a good system to record tests without slowing down your tests.

TestingBot Logo

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

Other Articles

blank

After some more optimisations in our code and infrastructure we've now reached the point where the average simple test takes 9 seconds. Compar...

Read more
blank

We've just finished upgrading our Selenium grid (the hub and all its RC nodes) to Selenium v2.15.0 This upgrade should provide improved stability....

Read more
blank

Selenium is the industry standard for automatically testing websites in browsers. A selenium test is a set of instructions that will be sent to a ...

Read more