Skip to content
Advertisement

Error Meta-data: {“dataFile”:”resources/env1/data.json”}@scenarios/jsonformfiller.feature#5 TestStep implementation not found

Error

Meta-data: {“dataFile”:”resources/env1/data.json”,”description”:”Data driven test that uses enter code herejson file to provide data”}@scenarios/jsonformfiller.feature#5 TestStep implementation not found. Please provide implementation or ensure ‘step.provider.pkg’ property value includes appropriate package.

Step Definition

    @QAFTestStep(description = "user is on google Web Page")
        public void step1() {
            
    try {    
            GooglePage googlepage = new GooglePage();
            googlepage.invoke();
            googlepage.waitForPageToLoad();
            System.out.println("I am on Google Search Page");
        } catch(Exception e) {
            
        }
        }
        @QAFTestStep(description = "user enters text {strText} in google search box")
        public void enterSearchText(String strText) {
            
            try {
                 GooglePage googlepage = new GooglePage();
                 googlepage.googleSearchTextBox.verifyPresent("google search TextBox");
                 googlepage.googleSearchTextBox.sendKeys(strText);
                System.out.println("I search for " + strText);
            } catch (Exception e) {
                
            }
        
        }

Could not include the whole step definitons code here stack overflow warning me that i added too much code

  Feature: Validate Web Form
  Scenario: Validate User is able to fill form using json Data File
   Meta-data: {"dataFile":"resources/env1/data.json","description":"Data driven test that uses 
   json file to provide data"}

      Given user is on clevermedia web form 
      When user enters first name '${firstname}' from json data file
      And user enters last name '${lastname}' from json data file
      And user enters zipcode '${zipcode}' from json data file
      And user enters message '${message}' from json data file
      And user clicks on submit 
      Then user should be able to submit form successfully 

Step Definition – all feature file test steps are defined in the below step definitions QAFTestSteps.

TestNG Configuration for Test Execution

  <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
   <suite name="QAF Demo" parallel="methods" verbose="0">
   <test name="QAF-BDD-Test">
      <parameter name="step.provider.pkg" value="com.qmetry.qaf.clevermedia.steps" />
      <parameter name="scenario.file.loc" value="scenarios/jsonformfiller.feature" />
      <parameter name="env.resources" value="resources/env1" />
   <classes>
     <class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
   </classes>
  </test>
  </suite>

Does anyone see an error in my step in implementing the Data Provider ? why am i getting this error? All feature file steps are defined or have the corrosponding QAFTestStep. Testng configuration for the test execution included above also appears to correct.

Advertisement

Answer

Gherkin syntax doesn’t have support of meta-data. You can use BDD2 syntax which is superset of Gherkin. In BDD2 you can provide scenario metadata on top of scenario:

Feature File

Feature: Validate Web Form

@dataFile:resources/env1/data.json
@description:Data driven test that uses json file to provide data
Scenario: Validate User is able to fill form using json Data File
   Given user is on clevermedia web form
   When user enters first name '${firstname}' from json data file
   And user enters last name '${lastname}' from json data file
   And user enters zipcode '${zipcode}' from json data file
   And user enters message '${message}' from json data file
   And user clicks on submit
   Then user should be able to submit form successfully

For BDD2 you need to use BDD2 factory instead of Gherkin factory. Refer documentation.

TestNG Configuration for Test Execution

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="QAF Demo" parallel="methods" verbose="0">
<test name="QAF-BDD-Test">
     <parameter name="step.provider.pkg" value="com.qmetry.qaf.clevermedia.steps" />
     <parameter name="scenario.file.loc" value="scenarios/jsonformfiller.feature" />
     <parameter name="env.resources" value="resources/env1" />
  <classes>
     <class name="com.qmetry.qaf.automation.step.client.text.BDDTestFactory2" />
  </classes>
</test>
</suite>

However recommended is BDD2, If you still want to use Gherkin syntax, it doesn’t have provision for meta-data or external test data. With QAF Gherkin factory supports data provider with examples as below to stick with gherkin syntax:

Scenario: Validate User is able to fill form using json Data File
....
Examples: {"dataFile":"resources/env1/data.json"}

Advertisement