Skip to content

WatchDog attribute

Viktor edited this page Mar 15, 2017 · 5 revisions

The [WatchDog] attribute is used to define the global rules of recording video for all tests in a specific class marked with the [TestFixture] Nunit attribute, therefore it can be applied on the class level only. This attribute and its settings can be overridden by the [Video] attribute on a test method level (if necessary).

The [WatchDog] attribute constructor takes the only one mandatory parameter which defines a video saving mode for all tests in a class. There are two possible values for this parameter: SaveInClass.AllTests (video for all tests in a class will be recorded and saved) or SaveInClass.FailedTestsOnly (recorded video will be saved for failed tests only).

Here are the examples of the attribute usage:

[TestFixture, WatchDog(SaveInClass.AllTests)]
public class MyClass
{
    // your tests here
}

or

[WatchDog(SaveInClass.FailedTestsOnly)]
[TestFixture]
public class MyAnotherClass 
{
    // your tests here
}

See the UsageAllClassLevelExamples file for more examples of the [WatchDog] attribute usage.

P.S. As mentioned above, the [WatchDog] attribute settings can be also overridden for specific tests, if necessary. Check the UsageFailedClassLevelExamples file for more examples of co-existing attributes in one class.

Clone this wiki locally