Search code examples
seleniumcucumberbddqafperfecto

Using But keyword in BDD throws Step not implemented exception while running scenario in Quantum framework


I am trying to run a BDD scenario in Quantum framework. While execution, the step with But keyword fails with error "Step not yet implemented".

Auto-generated code snippet by QMetry Automation Framework.
TODO: remove NotYetImplementedException and call test steps
    throw new NotYetImplementedException();

I do not see issue with any other BDD keywords. Only the steps starting with "But" keyword fail with the above exception. Is there anything that I am missing?

Please find the scenario we are using

Scenario: Validate help me log in link
Given user have the "XXX" app in mobile
But user open the app by the name "XXX"

Step implementation:

import cucumber.api.java.en.But;
...
    @But("^user open the app by the name \"([^\"]*)\"$")
    public void user_open_the_app_by_the_name(String arg1) throws Throwable {
        try {
            AppiumUtils.stopApp(arg1);
        } catch (Exception e) {
        } 
    }

Solution

  • QAF uses following BDD Keywords :

    • Given
    • When
    • Then
    • And
    • Using
    • Having
    • With

    As But is not inbuilt keyword it may give you error. It doesn't mean that you can't use But as keyword! There is a feature to support any custom keyword(s) by defining synonyms.

    You can try add following property in application.properties file:

    And=But;And
    

    This will allow you to use But as keyword and should resolve your issue.