NUnit Video Recorder has arrived!

Recently I have released the very first version of my NUnit video recorder pet project. What is this and how it can be useful for our test automation frameworks – I’m going to describe in this blog post. But before we start, let me explain what actually induced me to create this tool.

I was thinking about recording video for my functional test runs several years ago. I used to work with the Java-based test framework and it was nice to have a recorded video for some specific end-to-end tests (especially failed). Such recordings could simplify high-level understanding of what was going wrong. We utilized the Monte Media library and its Java API for recording video at that moment, however, we didn’t have time to think about a generic and flexible solution. Just a couple of video options, ScreenRecorder.start() and ScreenRecorder.stop() methods in proper places of a test class, and that’s it.

Time has passed, I switched to different technologies and C# programming language, and the need of recording video for functional GUI tests arose again. The framework was based on the C# and NUnit, so the solution had to have an API for this language. In the meantime, one friend of mine has already implemented the solution for Java with JUnit/TestNG integrations – Video Recorder. I was thinking to port his solution to C# initially but there were a lot of limitations and I decided to proceed with a new one from scratch. That’s how the NUnit Video Recorder was born…

So, what is the NUnit Video Recorder? It’s a .NET library for recording video from the screen during NUnit test runs. I have already added the Getting Started page on the GitHub wiki of the project. You can find necessary information how to add the NUnit Video Recorder to your project and examples of usage there. I would like to emphasize several moments here and give you links to usage examples.

It’s possible to manage recording video on 2 different levels: on the class level and on the method level. If you want to setup video recording for a single test, the workflow is pretty simple:

write your test → add the [Video] attribute to this test → provide optional parameters to the [Video] attribute → run your test

For example,

The Video attribute page contains more explanations for the optional parameters and examples of usage in different tests.

If you want to setup video recording for a whole class, the workflow is also pretty simple:

write your class with tests → add the [WatchDog] attribute to the class → specify the mandatory parameter for saving the video to the [WatchDog] attribute → run test in your class

For example,

or

The WatchDog attribute page also has links to extended examples and explanations.

A recorded video file is saved with the .avi extension to the Video subfolder of the output folder of the test project (usually it’s bin\Debug\ or bin\Release\ folders or folder with test *.dll files in case of running them via nunit-console runner). I haven’t provided the functionality which allows saving output files to a custom location yet but it may appear in the next releases.

There are several obvious limitations that you have to take into account:

  • No support for video recording of NUnit tests marked with [Repeat], [Retry], [Combinatorial] or any other attributes that manage to run a single test multiple times;
  • No Selenium Grid support;
  • No multi-display support.

These limitations can be converted to features in future releases but it takes a time to investigate and implement, so stay in touch, leave your feedback, suggest your ideas and feature requests. Any questions are welcome!

Like this post?

Subscribe to updates from my blog, if you don't want to miss more interesting future posts and materials

Please check your email and confirm subscription

Pin It on Pinterest

Share This