Annotations
Type |
Annotations |
Description |
Annotation |
|
Configuration information for a TestNG class:
Behaviour of annotations in superclass of a TestNG class The annotations above will also be honored (inherited) when placed on a superclass of a TestNG class. This is useful for example to centralize test setup for multiple test classes in a common superclass. In that case, TestNG guarantees that the "@Before" methods are executed in inheritance order (highest superclass first, then going down the inheritance chain), and the "@After" methods in reverse order (going up the inheritance chain). |
Annotation Attributes |
|
For before methods (beforeSuite, beforeTest, beforeTestClass and beforeTestMethod, but not beforeGroups): If set to true, this configuration method will be run regardless of what groups it belongs to. For after methods (afterSuite, afterClass, …): If set to true, this configuration method will be run even if one or more methods invoked previously failed or was skipped. |
|
The list of groups this method depends on. |
|
|
The list of methods this method depends on. |
|
|
Whether methods on this class/method are enabled. |
|
|
The list of groups this class/method belongs to. |
|
|
If true, this method will belong to groups specified in the @Test annotation at the class level. |
|
|
Only for @BeforeMethod and @AfterMethod. If specified, then this setup/teardown method will only be invoked if the corresponding test method belongs to one of the listed groups. |
|
Annotation |
|
Marks a method as supplying data for a test method. The annotated method must return an |
Annotation Attributes |
|
The name of this data provider. If it’s not supplied, the name of this data provider will automatically be set to the name of the method. |
|
If set to true, tests generated using this data provider are run in parallel. Default value is false. |
|
Annotation |
|
Marks a method as a factory that returns objects that will be used by TestNG as Test classes. The method must return |
Annotation |
|
Defines listeners on a test class. |
Annotation Attributes |
|
An array of classes that extend org.testng.ITestNGListener. |
Annotation |
|
Describes how to pass parameters to a @Test method. |
Annotation Attributes |
|
The list of variables used to fill the parameters of this method. |
Annotation |
|
Marks a class or a method as part of the test. |
Annotation Attributes |
|
If set to true, this test method will always be run even if it depends on a method that failed. |
|
The name of the data provider for this test method. |
|
|
The class where to look for the data provider. If not specified, the data provider will be looked on the class of the current test method or one of its base classes. If this attribute is specified, the data provider method needs to be static on the specified class. |
|
|
The list of groups this method depends on. |
|
|
The list of methods this method depends on. |
|
|
The description for this method. |
|
|
Whether methods on this class/method are enabled. |
|
|
The list of exceptions that a test method is expected to throw. If no exception or a different than one on this list is thrown, this test will be marked a failure. |
|
|
The list of groups this class/method belongs to. |
|
|
The number of times this method should be invoked. |
|
|
The maximum number of milliseconds this test should take for the cumulated time of all the invocationcounts. This attribute will be ignored if invocationCount is not specified. |
|
|
The priority for this test method. Lower priorities will be scheduled first. |
|
|
The percentage of success expected from this method |
|
|
If set to true, all the methods on this test class are guaranteed to run in the same thread, even if the tests are currently being run with |
|
|
The maximum number of milliseconds this test should take. |
|
|
The size of the thread pool for this method. The method will be invoked from multiple threads as specified by invocationCount. NOTE: this attribute is ignored if invocationCount is not specified |