Skip to content

Commit

Permalink
Closed #92 - Updated version of TestNG to 6.10
Browse files Browse the repository at this point in the history
  • Loading branch information
cjayswal committed Mar 24, 2017
1 parent 623c4b8 commit 2c35639
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 172 deletions.
2 changes: 1 addition & 1 deletion ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@


<!-- <dependency org="org.easytesting" name="fest-reflect" rev="1.4.1" /> -->
<dependency org="org.testng" name="testng" rev="6.9.10" conf="compile->default">
<dependency org="org.testng" name="testng" rev="6.10" conf="compile->default">
<artifact name="testng" type="jar"></artifact>
</dependency>
<dependency org="com.google.inject" name="guice" rev="3.0" conf="compile->default"/>
Expand Down
38 changes: 14 additions & 24 deletions src/org/testng/DependencyMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,8 @@ public class DependencyMap {

public DependencyMap(ITestNGMethod[] methods) {
for (ITestNGMethod m : methods) {
if (Scenario.class.isAssignableFrom(m.getRealClass())) {
System.out.println(" Scenario MethodName: " + m.getMethodName());

m_dependencies.put(m.getMethodName(), m);
} else {

m_dependencies.put(m.getRealClass().getName() + "." + m.getMethodName(), m);
} for (String g : m.getGroups()) {
m_dependencies.put( m.getQualifiedName(), m);
for (String g : m.getGroups()) {
m_groups.put(g, m);
}
}
Expand All @@ -66,9 +60,7 @@ public List<ITestNGMethod> getMethodsThatBelongTo(String group, ITestNGMethod fr

for (String k : uniqueKeys) {
if (Pattern.matches(group, k)) {
List<ITestNGMethod> temp = m_groups.get(k);
if (temp != null)
result.addAll(m_groups.get(k));
result.addAll(m_groups.get(k));
}
}

Expand All @@ -82,21 +74,19 @@ public List<ITestNGMethod> getMethodsThatBelongTo(String group, ITestNGMethod fr

public ITestNGMethod getMethodDependingOn(String methodName, ITestNGMethod fromMethod) {
List<ITestNGMethod> l = m_dependencies.get(methodName);
if (l == null && fromMethod.ignoreMissingDependencies()){
if (l.isEmpty() && fromMethod.ignoreMissingDependencies()){
return fromMethod;
}
if (l != null) {
for (ITestNGMethod m : l) {
// If they are in the same class hierarchy, they must belong to the same instance,
// otherwise, it's a method depending on a method in a different class so we
// don't bother checking the instance
if (fromMethod.getRealClass().isAssignableFrom(m.getRealClass())) {
if (m.getInstance() == fromMethod.getInstance()
|| m.getRealClass().isAssignableFrom(Scenario.class))
return m;
} else {
return m;
}
for (ITestNGMethod m : l) {
// If they are in the same class hierarchy, they must belong to the same instance,
// otherwise, it's a method depending on a method in a different class so we
// don't bother checking the instance
if (fromMethod.getRealClass().isAssignableFrom(m.getRealClass())) {
if (m.getInstance() == fromMethod.getInstance()
|| m.getRealClass().isAssignableFrom(Scenario.class))
return m;
} else {
return m;
}
}
throw new TestNGException("Method \"" + fromMethod
Expand Down
11 changes: 5 additions & 6 deletions src/org/testng/TestClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,21 @@
*******************************************************************************/
package org.testng;

import java.util.List;

import org.testng.collections.Lists;
import org.testng.collections.Objects;
import org.testng.internal.ConfigurationMethod;
import org.testng.internal.ConstructorOrMethod;
import org.testng.internal.NoOpTestClass;
import org.testng.internal.RunInfo;
import org.testng.internal.TestNGMethod;
import org.testng.internal.Utils;
import org.testng.internal.annotations.IAnnotationFinder;
import org.testng.xml.XmlClass;
import org.testng.xml.XmlTest;

import com.qmetry.qaf.automation.step.client.TestNGScenario;

import java.lang.reflect.Method;
import java.util.List;

/**
* This class represents a test class:
* - The test methods
Expand Down Expand Up @@ -211,11 +210,11 @@ private void initMethods() {
private ITestNGMethod[] createTestMethods(ITestNGMethod[] methods) {
List<ITestNGMethod> vResult = Lists.newArrayList();
for (ITestNGMethod tm : methods) {
Method m = tm.getMethod();
ConstructorOrMethod m = tm.getConstructorOrMethod();
if (m.getDeclaringClass().isAssignableFrom(m_testClass)) {
for (Object o : m_iClass.getInstances(false)) {
log(4, "Adding method " + tm + " on TestClass " + m_testClass);
vResult.add(new TestNGScenario(/* tm.getRealClass(), */ m, m_annotationFinder, m_xmlTest,
vResult.add(new TestNGScenario(/* tm.getRealClass(), */ m.getMethod(), m_annotationFinder, m_xmlTest,
o));
}
}
Expand Down

0 comments on commit 2c35639

Please sign in to comment.