Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

expose bug when using dependsOnMethods and a base test class

When two test classes in different packages extend from the same base
class, using the dependsOnMethods feature breaks the ordering promised
in the documentation:

    By default, TestNG will run your tests in the order they are found
    in the XML file.
  • Loading branch information...
commit 2467237e95c8ce2c964151453e603f787dbc61e3 0 parents
@jsnikeris authored
1  .gitignore
@@ -0,0 +1 @@
+target/
BIN  lib/testng-6.5beta.jar
Binary file not shown
43 pom.xml
@@ -0,0 +1,43 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+http://maven.apache.org/POM/4.0.0
+http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.snikeris</groupId>
+ <artifactId>testng-sandbox</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>6.5-beta</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/lib/testng-6.5beta.jar</systemPath>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.12</version>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>testng.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
10 src/test/java/a/A.java
@@ -0,0 +1,10 @@
+package a;
+
+import org.testng.annotations.Test;
+
+public class A extends Base {
+ @Test
+ public void testA() {
+ System.out.println("Test: A#testA");
+ }
+}
11 src/test/java/a/Base.java
@@ -0,0 +1,11 @@
+package a;
+
+import org.testng.annotations.AfterClass;
+
+public class Base {
+ @AfterClass
+ public void cleanup() {
+ System.out.println(String.format("AfterClass: %s#cleanup",
+ getClass().getSimpleName()));
+ }
+}
15 src/test/java/b/B.java
@@ -0,0 +1,15 @@
+package b;
+
+import org.testng.annotations.Test;
+
+public class B extends a.Base {
+ @Test
+ public void testB() {
+ System.out.println("Test: B#testB");
+ }
+
+ @Test(dependsOnMethods = {"testB"})
+ public void dependsOnTestB() {
+ System.out.println("Test: B#dependsOnTestB");
+ }
+}
13 testng.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+
+<suite name="suite">
+ <test name="test">
+ <classes>
+ <class name="b.B"/>
+ </classes>
+ <packages>
+ <package name="a"/>
+ </packages>
+ </test>
+</suite>
Please sign in to comment.
Something went wrong with that request. Please try again.