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 affected in the testng
report.
相关问题
- TestNG report with customized error in place of st
- TESTNG: how to send emailable report as an email
- org.testng.TestNGException: sun.security.provider.
- Combining 2 reports into one 1 in (testng) allure
- Debugging TestNG configuration failures
相关文章
- TestNG skipping tests - why?
- How to test a Validator which implements Constrain
- Is it safe to use DateTimeUtils.setCurrentMillisFi
- How to use @FindBy annotation in Selenium WebDrive
- use verify on mocked (with Mockito) objects inject
- How to run TestNG suite with failsafe without unpa
- How to install TestNG eclipse plugin offline?
- TetsNG SoftAssert with Hamcrest matcher
You can add multiple tests in testngSuite and execute. Under all tests the classes names should be same inorder to execute same script multiple number of times.
You cannot do it from the xml, but it can be achieved by using @DataProvider annotation in TestNG.
Here is a sample code:
None of the answers so far really give the user the ability to up the invocation count from the testng file, which is what was asked for. This solution piggybacks off of gaurav25's DataProvider solution.
Now you can alter how many test sets get run through the test function with this testng.xml file:
By using @Factory and @DataProvider annotation of TestNG you can execute same test-case multiple times with different data.
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.
You have missed closing curly bracket at the end, so a small correction.
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
xml snippet