Priority of test methods is ignored
See original GitHub issueTestNG Version
org.testng:testng:7.0.0
(This worked just fine with version 6.9.6)
Expected behavior
Because of the set priorities I expect following execution order: test05 test04 test02 test03 test01
This works when running from Eclipse IDE.
Actual behavior
Unfortunately, when running from IntelliJ or Gradle (tried with 5.4.1 and 5.6.2) it results in following execution order: test01 test02 test03 test04 test05
Is the issue reproductible on runner?
- Shell
- Maven
- Gradle
- Ant
- Eclipse
- IntelliJ
- NetBeans
Test case sample
I have following test class:
public class TryOut {
@Test(priority = 4)
public void test01() {
System.out.println("test01");
}
@Test(priority = 3)
public void test02() {
System.out.println("test02");
}
@Test(priority = 3)
public void test03() {
System.out.println("test03");
}
@Test(priority = 2)
public void test04() {
System.out.println("test04");
}
@Test(priority = 1)
public void test05() {
System.out.println("test05");
}
}
build.gradle:
plugins {
id 'java'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.testng:testng:7.0.0'
}
// Test Logging
test {
useTestNG()
testLogging {
showStandardStreams = true
}
}
The Gradle command:
./gradlew test --tests mypackage.TryOut
Here the complete Gradle project: TestNgExample.zip
Issue Analytics
- State:
- Created 4 years ago
- Comments:28 (4 by maintainers)
Top Results From Across the Web
TestNG Test Case Priority And Sequence - Tools QA
The test methods with no priority assigned have a default priority equal to 0. It means if we define no priorities, all the...
Read more >testng not running in priority order when dependsOnMethods ...
My solution was to add the dependsOnMethods to ALL of my test methods, while I kept the priority also for ALL of the...
Read more >Order of execution for Tests in TestNg, If Priority set only for ...
If you are not using any priority in your test method then TestNG assign by default priority=0 to the Test Method; If there...
Read more >TestNG @Test Priority in Selenium - Guru99
If we don't mention any priority, testng will execute the @Test methods based on alphabetical order of their method names irrespective of ...
Read more >TestNG Tutorials 22: @Test Annotation - Games Of Priority Of ...
TestNG ignore default priority based on ASCII if priority value is provided. You can pass duplicate priority to test methods. In case of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Problem with 7.4.0 is still exist. I am using Gradle project.
I’m able to reproduce the issue in a fresh IntelliJ project but not if I add the test in the TestNG project itself. I confirm the issue happens only with 7.x versions and not previous ones.