1 year ago

#73607

test-img

Avinash

ParameterType not identifying the method

For some reason, ParameterType is giving me the below error:

Undefined parameter type {query}. Please register a ParameterType for {query}.

However, if you see the below code, I have created a method for this. Any input is really appreciated. I tried reading the cucumber docs but couldn't understand how to resolve this.

public class SearchFeatureStepDefs {
    
    @ParameterType(".*")
    public String query(String inputQuery) {
        return inputQuery;
    }
    
    @Given("the search page is open")
    public void theSearchPageIsOpen() {}
    
    @When("I search the query {query}")
    public void iSearchTheQuery(String query) {}
    
    @Then("the query result should be displayed")
    public void theQueryResultShouldBeDisplayed() {}
    
}

Below is the Gherkin:

 Feature: Google search
    Background: Load google homepage
        Scenario Outline: searching queries
            Given the search page is open
                When I search the query <query>
                    Then the query result should be displayed
Examples:
                    | query |
                    | "How to train your dragon" |

cucumber

ui-automation

bdd

cucumber-java

cucumber-junit

0 Answers

Your Answer

Accepted video resources