TestNG: How can I run same test case multiple times?

后端 未结 8 1265
你的背包
你的背包 2020-12-30 20:22

I want to run a test case multiple times. Is that configurable in the testng.xml? If I add a loop in the test method, then the results of each run will not be a

8条回答
  •  我在风中等你
    2020-12-30 20:56

    I know pretty late to the party but if your aim is to achieve report for each run then you can try TestNG Listener IAnnotationTransformer

    code Snippet

    public class Count implements IAnnotationTransformer {
    
        @Override
        public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {
            // TODO Auto-generated method stub
            annotation.setInvocationCount(numberOfTimesTOExecute);
        }
    

    xml snippet

    
    
    

提交回复
热议问题