![]() timeOut: The attribute timeOut is used for a time out test. It acts as a loop.įor example: = 5) // This method will execute 5 times.ġ1. invocationCount: This attribute is used to execute a method the number of times. For more detail, go to this tutorial: TestNG Groupsġ0. groups: It specifies the list of groups this method or class belongs to. This is because exception thrown by test method does not match with exception provided in the expectedExceptions list.ĩ. In the above program, a class contains two test methods exceptionTestOne and exceptionTestTwo which throws IOException and Exception respectively.Īs you can see from the test output, the test method exceptionTestTwo() has been marked as failed by TestNG during execution. Public void exceptionTestTwo() throws Exception If any test method belonging to a particular group is failed, the dependent test method will not be run and will be flagged as a SKIP. We can also specify a list of groups this method depends on.Īll of the methods of these groups are executed first before this method. dependsOnGroups: This attribute is used to make test methods depend on a particular group. Where, Hello is the name of class where DataProvider method has been declared.Ĥ. = "getData", dataProviderClass = Hello.class) dataProviderClass: This attribute is used to call the DataProvider method from another class. dataProvider: This attribute is used to provide data to the test method directly in data-driven testing. Program source code 2: package testAnnotation Ģ.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |