I know we can use the invocationCount to repeat the test method for the given number like below:
@Test(invocationCount = 10)
public void example() {
System.out.println("Bla Bla");
}
I want to set the "invocationCount" (repeat count) at the runtime from testNG test plan. But since annotations accepts only constants I couldn't pass a dynamic variable as value for invocationCount. Is there a way to acheive this?
You can implement an IAnnotationTransformer
to change the value of innvocationCount
at runtime. Refer to this in official documents - http://testng.org/doc/documentation-main.html#annotationtransformers . There is an exact implementation in it for what you are attempting.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.