Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

By EasonYi: #2248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ z_build
.kobalt
.DS_Store

.vscode/
9 changes: 9 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
Current
By EasonYi: feature/6.14.3/can-use-one-test-class-or-method-many-times-in-one-xml-test-case
New: Allow the same method in one class for more than one time
New: Allow the same class in one test for more than one time
New: Upgrade to Java 8
Fixed: Adjust the default parallel mode of SuiteRunner to TESTS
Fixed: Wrong implementation about parameters overriding
Notice: Since a lot of things have been changed, but only XML style was tested, that is JUnit and others are NOT tested by now, and you can find the tests in src/test/java/test/duplicate directory

6.14.3
Fixed: GITHUB-1077: TestNG cannot handle load (Aheiss)
Fixed: GITHUB-1081: group-by-instances with test dependencies causes instantiation of tests to exponentially slow (Aheiss)
Fixed: GITHUB-1700: Test ignored if @BeforeMethod in base class fails for another test class (Krishnan Mahadevan)
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ apply plugin: 'osgi'
apply plugin: 'version-injection'
apply plugin: 'eclipse'

targetCompatibility = "1.7"
sourceCompatibility = "1.7"
targetCompatibility = "1.8"
sourceCompatibility = "1.8"

eclipse {
classpath {
Expand Down
25 changes: 19 additions & 6 deletions src/main/java/org/testng/IClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ public interface IClass {
* @return this test class name. This is the name of the
* corresponding Java class.
*/
String getName();
default String getName() {
return getXmlClass().getName();
}

/**
* @return the <test> tag this class was found in.
Expand All @@ -24,33 +26,44 @@ public interface IClass {
*/
XmlClass getXmlClass();

default String getNameIndex() {
return getXmlClass().getNameIndex();
}

default int getIndex() {
return getXmlClass().getIndex();
}

/**
* If this class implements org.testng.ITest, returns its test name, otherwise returns null.
*/
String getTestName();
default String getTestName() {
return getXmlTest().getName();
}

/**
* @return the Java class corresponding to this IClass.
*/
Class<?> getRealClass();
default Class<?> getRealClass() {
return getXmlClass().getSupportClass();
}

/**
* Returns all the instances the methods will be invoked upon.
* This will typically be an array of one object in the absence
* of a @Factory annotation.
*
* @param create flag if a new set of instances must be returned
* (if set to <tt>false</tt>)
* (if set to <tt>false</tt>)
* @return All the instances the methods will be invoked upon.
*/
Object[] getInstances(boolean create);

/**
* @deprecated Not used
*
* @return The number of instances used in this class. This method
* is needed for serialization since we don't know ahead of time if the
* instances of the test classes will be serializable.
* @deprecated Not used
*/
@Deprecated
int getInstanceCount();
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/testng/ITestClassFinder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.testng;

import org.testng.xml.XmlClass;

/**
* This class is used by TestNG to locate the test classes.
*
Expand All @@ -19,6 +21,7 @@ public interface ITestClassFinder {
/**
* Return the IClass for a given class
*/
IClass getIClass(Class<?> cls);
// IClass getIClass(Class<?> cls);
IClass getIClass(XmlClass xmlClass);

}
12 changes: 8 additions & 4 deletions src/main/java/org/testng/ITestMethodFinder.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package org.testng;

import org.testng.xml.XmlClass;
import org.testng.xml.XmlTest;




/**
* This interface allows to modify the strategy used by TestRunner
* to find its test methods. At the time of this writing, TestNG
Expand All @@ -13,14 +12,19 @@
* methods that start with "test" or have a suite() method).
*
* @author Cedric Beust, May 3, 2004
*
*/
public interface ITestMethodFinder {

/**
* @return All the applicable test methods.
*/
ITestNGMethod[] getTestMethods(Class<?> cls, XmlTest xmlTest);
default ITestNGMethod[] getTestMethods(Class<?> cls, XmlTest xmlTest) {
return null;
}

default ITestNGMethod[] getTestMethods(XmlClass xmlClass, XmlTest xmlTest) {
return null;
}

/**
* @return All the methods that should be invoked
Expand Down
Loading