TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    JBehave

    JBehave Ambiguous Steps

    JBehave

    In this post, we will discuss JBehave Ambiguous Steps.

    What is an Ambiguous Step?

    If the gherkin matches more than one matching steps, then it is called an Ambiguous Step. An ambiguous step matches multiple methods in step classes. Also, this often happens in large projects while writing a number of stories. However, the story editor, for example, eclipse plugin editor, warns you about ambiguous steps if the steps are statically defined. Furthermore, ambiguous steps lead to undesirable execution if we don’t prioritize them or define a prioritizing strategy.

    Example:

    We will see some simple examples below to clarify things. Lets us take a simple gherkin text below which matches 2 matching steps:
    Given bing search homepage

    We have made the above Gherkin text to match 2 steps as shown in the below picture. Two step candidates have been provided i.e two different implementations in step classes for the same gherkin textual step. We may need to resolve this ambiguity either by resolving the ambiguity or setting priority to steps.

     

    JBehave_Ambigious_Steps1

    The warning is shown by the story editor:

    Ambiguous step: 2 steps are matching <Given bing search homepage > got: [[GIVEN]bing search homepage, BingSteps#openBing, [GIVEN]bing search homepage, CommonSteps#openBing]

    bing search homepage (com.testingdocs.stock.steps.BingSteps.java#openBing)
    bing search homepage (com.testingdocs.stock.steps.CommonSteps.java#openBing)

    Matching methods as shown below:

    step method 1 in BingSteps

    
    
    @Given("bing search homepage")
        public void openBing()
        {
            //    This is in BingSteps.class
            System.out.println(this.getClass()+ "step method invoked");
       
        }

     

    step method 2 in CommonSteps

    @Given("bing search homepage")
        public void openBing()
        {
    
           //This is in CommonSteps.class
            System.out.println(this.getClass()+ "step method invoked");
       
        }

     

    JBehave AmbigiousSteps
    JBehave AmbigiousSteps

     

     

    JBehave Tutorials on this website can be found at:
    https://www.testingdocs.com/jbehave-framework-tutorial/

    For more details on the JBehave framework, visit the official JBehave website at:
    http://jbehave.org

    Related Posts

    Create a New Project Eclipse

    JBehave /

    Cucumber Java BDD Selenium Framework

    JBehave + Serenity Sample Project

    JBehave /

    JBehave + Serenity Sample Project

    Serenity BDD Automation Framework

    JBehave /

    Serenity BDD Automation Framework

    Serenity Maven Artifacts

    JBehave /

    Serenity Maven Artifacts

    Introduction to Serenity BDD

    JBehave /

    Introduction to Serenity BDD

    ‹ @BeforeStories / @AfterStories JBehave Annotations› Configure JBehave Stories

    Recent Posts

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com