-
Notifications
You must be signed in to change notification settings - Fork 6
Getting started
This Wiki contains the documentation for the end user of the NUnit Test Video Recorder as well as explanations and examples of usage.
The NUnit Video Recorder is based on the SharpAvi library for recording video from the screen. The implemented back-end looks for the list of MPEG-4 codecs installed in the system and selects an optimal one based on the internal SharpAvi logic. In case, if there are no MPEG-4 codecs installed, NUnit Video Recorder initiates capturing video with the MotionJpeg codec. Configuring video parameters is not exposed to the end user for now, however it's a subject of discussion for future releases.
Recorded video file is saved with the .avi
extension to the Video
sub-folder 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). For more convenience, a separate sub-folder is created for each test class. In case, if the file with the same name already exists in the sub-folder, it will be overwritten.
The fastest and easiest way to add the NUnit Video Recorder to a test project is through NuGet. After it's added as a reference, its features become available (don't forget to add using NunitVideoRecorder;
to each *.cs file with NUnit tests).
Recording video in the NUnit Video Recorder is managed by two attributes:
- Video attribute that is applied on the test method level and manages recording and saving video for a particular test only;
- WatchDog attribute that is applied on the test class level and manages recording and saving video for all tests in a particular class.
Typical usage of both attributes looks like this:
using NUnit.Framework;
using NunitVideoRecorder;
namespace NunitVideoRecorderExamples
{
[WatchDog(SaveInClass.FailedTestsOnly)]
[TestFixture]
public class MyTestClass()
{
[Test]
[Video(Name = "Very important test", Mode = SaveMe.Always)]
public void MyTest()
{
// your code here
}
}
}
Mode detailed explanations and examples are provided on the related Wiki pages of the Video and WatchDog attributes.