I have a cucumber project that uses spring boot and testng.
Here the principal classes
@SpringBootTest
public class CucumberTestDefinitions extends FunctionalTesting {
@Given("Something")
public void smthg(){
}
}
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = FunctionalTestingApp.class, initializers =
ConfigFileApplicationContextInitializer.class)
public class FunctionalTesting {
@Autowired
protected FunctionalTestingConfiguration configuration;
}
@EnableConfigurationProperties(value = {FunctionalTestingConfiguration.class})
public class FunctionalTestingApp {
}
@EnableAutoConfiguration
@ConfigurationProperties(prefix = "testing")
@Data
public class FunctionalTestingConfiguration {
// the config from yml file
}
I have no testng.xml file as tests are launched with spring-boot. For some reasons, I would like to prioritize tests and I saw I could do with QAF (https://qmetry.github.io/qaf/latest/scenario-meta-data.html#pre-defined-meta-data-for-bdd). I tried to use it but it didn't work.
Here what I did:
I added the dependency to pom.xml (I use cucumber 5)
I added this annotation @QAFTestStepProvider
to CucumberTestDefinitions class
I added this plugin "com.qmetry.qaf.automation.cucumber.QAFCucumberPlugin"
in RunnerTest class
Here the error
java.lang.NoSuchMethodError: 'java.lang.reflect.Method com.qmetry.qaf.automation.step.client.TestNGScenario.getMethod()'
I tried adding a testng.xml file in config folder but it didn't help
Is QAF spring-boot compatible?
Thanks a lot for helping
EDIT
pom.xml :
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-spring</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.qmetry</groupId>
<artifactId>qaf-cucumber</artifactId>
<version>3.0.0</version>
</dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version>
The Runner class
features = {"src/test/resources/toto"})
public class RunnerTest extends AbstractTestNGCucumberTests {
@Autowired
private ObjectMapper objectMapper;
@Override
@DataProvider(parallel = true)
public Object[][] scenarios() {
return super.scenarios();
}
@PostConstruct
public void setUp() {
objectMapper.registerModule(new JavaTimeModule());
}
}
error message
java.lang.NoSuchMethodError: 'java.lang.reflect.Method com.qmetry.qaf.automation.step.client.TestNGScenario.getMethod()'
at com.qmetry.qaf.automation.step.client.TestNGScenario.init(TestNGScenario.java:92)
at com.qmetry.qaf.automation.step.client.TestNGScenario.<init>(TestNGScenario.java:70)
at com.qmetry.qaf.automation.step.client.TestNGScenario.<init>(TestNGScenario.java:64)
at com.qmetry.qaf.automation.testng.TestRunnerFactory.convert(TestRunnerFactory.java:76)
at com.qmetry.qaf.automation.testng.TestRunnerFactory.init(TestRunnerFactory.java:67)
at com.qmetry.qaf.automation.testng.TestRunnerFactory.newTestRunner(TestRunnerFactory.java:63)
at org.testng.ITestRunnerFactory.newTestRunner(ITestRunnerFactory.java:55)
at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:676)
at org.testng.SuiteRunner.init(SuiteRunner.java:178)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:112)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1275)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1251)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1100)
at org.testng.TestNG.runSuites(TestNG.java:1039)
at org.testng.TestNG.run(TestNG.java:1007)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:110)