Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sequence order mis-calculation: testing using suite in sequence for c…

…lasses and same method names creates non-sequencial order
  • Loading branch information...
commit 9da51c4838f0ff781b11b91ca7e63c5ef87d656f 1 parent 9f2367a
cbeust authored
Showing with 20 additions and 1 deletion.
  1. +1 −0  CHANGES.txt
  2. +2 −0  TODO.txt
  3. +17 −1 src/main/org/testng/TestRunner.java
View
1  CHANGES.txt
@@ -10,6 +10,7 @@ Added: @BeforeMethod and @AfterMethod methods can now be injected an ITestResult
Added: ISuite#getAttribute and ISuite#setAttribute to share data within a suite
Added: @Test(expectedExceptionsMessageRegExp = ".*foo.*")
Added: @DataProvider(parallel=true)
+Fixed: TESTNG-317: Sequence order mis-calculation: testing using suite in sequence for classes and same method names creates non-sequential order
Fixed: Test names (classes that implement org.testng.ITest) now appear more prominently in the HTML reports
Fixed: expectedExceptions=RuntimeException.class was not failing when no exception was throw
Fixed: TESTNG-291: Exceptions thrown by Iterable DataProviders are not caught, no failed test reported (Roberto Tyley)
View
2  TODO.txt
@@ -1,5 +1,7 @@
TODO for TestNG
+* Pass the XmlTest in @Before/@After methods
+* Allow a testng.xml file to be passed when -testjar is used
* Add onStart to IConfigurationListener (create a new interface, actually)
* Add timeout to @Before/@After
* Pass parameters from ant
View
18 src/main/org/testng/TestRunner.java
@@ -870,7 +870,16 @@ else if (currentMethodsDependedUpon.length > 0) {
}
// Is there a method that depends on the current method?
else if (containsString(methodsDependedUpon, thisMethodName)) {
- sequentialList.add(0, tm);
+ int index = 0;
+ for (int j = 0; j < sequentialList.size(); j++) {
+ ITestNGMethod m = sequentialList.get(j);
+ if (arrayContains(m.getMethodsDependedUpon(), thisMethodName)) {
+ index = j;
+ break;
+ }
+ }
+ // Insert the dependee as close to its dependent as possible (TESTNG-317)
+ sequentialList.add(index, tm);
}
else if (currentGroups.length > 0) {
boolean isSequential= false;
@@ -902,6 +911,13 @@ else if (currentGroups.length > 0) {
sl.addAll(sequentialAttributeList.values());
}
+ private boolean arrayContains(String[] array, String element) {
+ for (String a : array) {
+ if (element.equals(a)) return true;
+ }
+ return false;
+ }
+
/**
* Logs the beginning of the {@link #beforeRun()} .
*/
Please sign in to comment.
Something went wrong with that request. Please try again.