What are the different NUnit annotations for Selenium automation testing?
1 Like
Hey Aaron,
Here is a list of NUnit annotations that you can use while performing Selenium automation tesing.
| Annotation | Description |
|---|---|
| [SetUp] | One method per test class. |
| [TearDown] | One method per test class. |
| [TestFixture] | Marks a class that contains tests. |
| [Test] | Marks a method. |
| [TestCase] | Marks a method with parameters. |
| [TestFixtureSetUp] | Marks a method that is executed once before any test method execution in that fixture. |
| [TestFixtureTearDown] | Marks a method that is executed after the last test method in that fixture has finished execution. |
| [Ignore] | Marks a test method that should not be considered for execution. |
| [Category] | Specify the test category. |
| [Indicates] | Marks that the test should be skipped. |
| [OneTimeSetUp] | Methods that should be called before the child tests execution. |
| [OneTimeTearDown] | Methods that should be called after the child tests execution. |
| [Culture] | Indicates cultures for which a test should be executed. |
| [MaxTime] | Maximum time frame in milliseconds. |
| [Platform] | Platforms on which the test execution should be performed. |
| [TimeOut] | Timeout value in milliseconds. |
| [Retry] | Test will re-run if it fails till the time it is either successful/maximum number of times have reached. |
| [Repeat] | Specifies the method that needs to be executed/repeated number of times. |
| [ExpectedException(ExceptionType)] | Marks a test that can raise a particular exception, i.e., ExceptionType. |
| [Random] | Specifies generation of random values to be passed as arguments to the parameterized tests. |
To know more about annotations and their practical implementation go through the blog on How To Use NUnit Annotations For Selenium Automation Testing [With Example]
4 Likes