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

后端 未结 8 1203
你的背包
你的背包 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条回答
  •  旧时难觅i
    2020-12-30 20:50

    You cannot do it from the xml, but in the @Test annotation - you can add a invocationCount attribute with the number of times you want to run it. It would come out as those many tests run in the report.

    eg.

    @Test(invocationCount = 10)
    public void testCount() {..}
    

    You have missed closing curly bracket at the end, so a small correction.

提交回复
热议问题