I've created Maven project which has structure like following:
src/main/java
src/main/resources
src/test/java
src/test/resources
I've kept my TestNG tests in src/test/java
folder. Suppose in this folder, I've three classes:
- YahooTest
- GoogleTest
- TwitterTest
and each of one have few TestNG test methods.
When I hit mvn clean test
on command prompt, I observed tests running in following order:
- test from GoogleTest
- test from TwitterTest
- test from YahooTest
- test from GoogleTest
- test from TwitterTest
- test from YahooTest
- test from GoogleTest
- test from TwitterTest
- test from YahooTest
Means first classes are ordered in alphabetical order i.e. GoogleTest, TwitterTest, YahooTest and then one test from each class is executed and again one test from each class is executed. This continues until all test methods execution finishes.
But I want to customize the test execution.
How can I achieve following:
- Arrange test execution of test classes in the order I want rather than in alphabetical order
- Instead of executing one test method from each test class and then one test method from each test class ..., execute all test cases from same class and then move to another test class