0

I am using cucumber-testng framework in my Project. Now i am trying to integrate with QAF to use csv file as a data provider. I don't use properties file instead i use yaml file

I want to achieve like this with QAF

Feature:

@device_Android @Test Meta-data: {"dataFile":"resources/data/logintestdata.csv"}

Scenario Outline: 001-test Given test

my code:

TestNG xml-
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="QAF-BDD-Test">
    <test verbose="2" preserve-order="true" name="mID Tests for Real device">
        <parameter name="step.provider.pkg" value="com.zetes.pass.diw.mid.stepDefinitions" />
        <parameter name="scenario.file.loc" value="src/test/resources/features" />
      </parameter>
        <parameter name="host" value="realDevice"/>
        <groups>
            <run>
                <include name="Test"/>
            </run>
        </groups>
        <classes>
            <class name="com.qmetry.qaf.automation.step.client.text.BDDTestFactory2" />
        </classes>
    </test>

</suite>

Test Runner

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import io.cucumber.testng.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import javax.annotation.PostConstruct;

@Slf4j @CucumberOptions(features = "src/test/resources/features/", glue = {
      "hooks", "runner"}, plugin = {"pretty",
        "html:target/cucumber-reports/Cucumber.html",
        "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"
     }) public class RunCucumberTest
        extends AbstractTestNGCucumberTests {
    private TestNGCucumberRunner testNGCucumberRunner;
    @Autowired private ObjectMapper objectMapper;

    @Test(groups = "cucumber", description = "Runs Cucumber Scenarios", dataProvider = "scenarios")
    public void runScenario(PickleWrapper pickleWrapper, FeatureWrapper featureWrapper) {
        super.runScenario(pickleWrapper, featureWrapper);
    }

    @Override @DataProvider(name = "scenarios") public Object[][] scenarios() {
        return super.scenarios();
    }

    @PostConstruct public void setUp() {
        objectMapper.registerModule(new JavaTimeModule());
    }
}


below is the error

Added "QAFMethodSelector"
2023-01-26 18:28:51 ERROR PropertyUtil:216 - resources\application.properties (The system cannot find the path specified)
2023-01-26 18:28:51 INFO  ConfigurationManager:173 - ISFW build info: {qaf-Type=core, qaf-Revision=0, qaf-Build-Time=27-Feb-2022 14:37:01, qaf-Version=3.1}
2023-01-26 18:28:51 ERROR ConfigurationManager:277 - \resources not exist!
include groups [Test]
 exclude groups: [] Scanarios location: src/test/resources/features 
2023-01-26 18:28:51 INFO  BDDTestFactory2:76 - scenario.file.loc[Ljava.lang.String;@1a4013
2023-01-26 18:28:51 INFO  BehaviorScanner:123 - loading feature file: abc.feature
2023-01-26 18:28:51 INFO  BDDTestFactory2:82 - total test found: 1
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 15 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.collectMethodsByGroup() took 0 ms.
2023-01-26 18:28:51 INFO  Utils:112 - [Utils] MethodGroupsHelper.sortMethods() took 0 ms.
java.lang.NoSuchMethodError: 'void org.testng.internal.TestNGMethod.<init>(java.lang.reflect.Method, org.testng.internal.annotations.IAnnotationFinder, org.testng.xml.XmlTest, java.lang.Object)'
    at com.qmetry.qaf.automation.step.client.TestNGScenario.<init>(TestNGScenario.java:71)
    at com.qmetry.qaf.automation.step.client.TestNGScenario.<init>(TestNGScenario.java:64)
    at org.testng.internal.NoOpTestClass.convert(NoOpTestClass.java:185)
    at org.testng.internal.NoOpTestClass.getTestMethods(NoOpTestClass.java:93)
    at org.testng.TestRunner.initMethods(TestRunner.java:481)
    at org.testng.TestRunner.init(TestRunner.java:336)
    at org.testng.TestRunner.init(TestRunner.java:289)
    at org.testng.TestRunner.<init>(TestRunner.java:219)
    at com.qmetry.qaf.automation.testng.TestRunnerFactory.newTestRunner(TestRunnerFactory.java:60)
    at org.testng.ITestRunnerFactory.newTestRunner(ITestRunnerFactory.java:52)
    at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:710)
    at org.testng.SuiteRunner.init(SuiteRunner.java:225)
    at org.testng.SuiteRunner.<init>(SuiteRunner.java:115)
    at org.testng.TestNG.createSuiteRunner(TestNG.java:1349)
    at org.testng.TestNG.createSuiteRunners(TestNG.java:1325)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1167)
    at org.testng.TestNG.runSuites(TestNG.java:1099)
    at org.testng.TestNG.run(TestNG.java:1067)
    at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
    at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)

please can someone help me on this

I tried to debug why am getting this error and am looking to use yaml file instead of properties file , if that solves the error am getting

type here
  • which version of testng, qaf and cucumber you are using? Also if you want to use cucumber with testng runner and data provider capabilities, you don't need to create class `RunCucumberTest` instead of that use [CucumberScenarioFactory](https://github.com/qmetry/qaf-cucumber/issues/10#issuecomment-912721331) which is available in [qaf-cucumber](https://github.com/qmetry/qaf-cucumber) library – user861594 Jan 26 '23 at 18:32
  • i use below versions testNG-7.7.0,qaf.cucumber-3.1.0,cucumber-7.10.1 So i have removed RunCucumberTest based on your comment. and used Cucumber scenario Factory. – user12286377 Jan 27 '23 at 05:59
  • Now i get this error Added "QAFMethodSelector" [[TestNGClassFinder]]Unable to read methods on class com.qmetry.qaf.automation.cucumber.runner.CucumberScenarioFactory - unable to resolve class reference io/cucumber/core/runtime/TypeRegistryConfigurerSupplier ERROR PropertyUtil:216 - resources\application.properties (The system cannot find the path specified) INFO ConfigurationManager:ISFW build info: {qaf-Type=core, qaf-Revision=0, qaf-Build-Time=27-Feb-2022 14:37:01, qaf-Version=3.1} ERROR ConfigurationManager:277 - C:\tests\resources not exist! [TestNG]No tests found.Nothingwasrun – user12286377 Jan 27 '23 at 06:07

1 Answers1

0

QAF-cucumber supports cucumber version 5.x. If you don't have cucumber' specific version requirement, you should try with following cucumber and testng dependencies in your pom file.

<!-- https://mvnrepository.com/artifact/com.qmetry/qaf-cucumber -->
<dependency>
    <groupId>com.qmetry</groupId>
    <artifactId>qaf-cucumber</artifactId>
    <version>3.2.0b</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-core</artifactId>
    <version>5.4.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>5.4.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.4.0</version>
    <scope>test</scope>
</dependency>

References:

user861594
  • 5,733
  • 3
  • 29
  • 45