Eclipse/Maven/Java/Selenium/TestNG
My very simple test:
@DataProvider( name="suite")
public Object[][] dpMethod_suite() {
return new Object[][] {{"diamonds"},{"hearts"},{"clubs"},{"spades"}};
}
@Test( dataProvider="suite") // <---- throws the errmsg
public void Test_01( String suite) {
boolean testPassed = true;
System.out.println("suite passed in: " + suite);
Assert.assertEquals( testPassed, true);
}
should produce 4 executions of test Test_01 but instead throws a runtime error
java.lang.ClassCastException: org.testng.internal.TestNGMethod cannot be cast to com.qmetry.qaf.automation.step.client.TestNGEcenario
which is exactly the problem discussed in https://github.com/qmetry/qaf/issues/247
so I adjusted my pom so qaf stuff is brought in before testng stuff.
<parent>
<groupId>com.xxxxx.eqe</groupId>
<artifactId>xxxxx.lib.eqe.parent</artifactId>
<version>2.3</version>
</parent>
<dependencies>
<dependency>
<groupId>com.qmetry</groupId>
<artifactId>qaf</artifactId>
<version>2.1.14</version>
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.qmetry</groupId>
<artifactId>qaf-support</artifactId>
<version>2.1.14</version>
</dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.10</version>
</dependency>
</dependencies>
Results of
mvn dependency:tree
yields
+- com.xxxxxxx.eqe:xxxxxxx-eqe-automation.jar
+- com.qmetry:qaf
+- org.hamcrest stuff
+- com.sun.jersey stuff
+- org.aspectj stuff
..... alot of stuff but NO testng stuff
+- com.qmetry:qaf-support
+- org.seleniumhq:selenium-java
.....
+- org.seleniumhq:selenium-support
.....
.... more stuff but NO testNG stuff
+- org.testng:testng
+- com.beust:jcommander
+- some other stuff
so I'm pretty confident testng is brought in after all QAF stuff as indicated by the github article
So either a) I'm wrong, b) the solution on github is wrong or c) who knows?
Any solutions/idea/constructive criticisms would be appreciated.
TIA,
Still-Learning Steve