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

    JBehave

    Filter Stories in JBehave

    JBehave

    Overview

    In this post, we will learn how to filter stories or scenarios during automation dry runs. In real projects, you have many stories under the project folder. It’s important to keep the stories well organized by grouping the scenarios.

    When you execute the stories, you have several ways to filter the stories. The most common way to
    filter stories are to use the meta filter.

    Example

    Let’s say your project has hundreds of stories. Consider the fact that you have automated a scenario or story in the project. You may want to quickly run the scenario and verify your automation effort and exclude all the other stories to be executed in the project.

    Filtering Stories

    Add the meta filter in the story or scenario.

    Meta:
    @dryrun

    For example story we have to run and exclude all other stories in the project.
    ————

    Lookup a definition
    Narrative:
    In order to do Mathematics better
    As a Maths student
    I want to look up math word definitions

    Meta:
    @dryrun

    Scenario: Looking up the definition of ‘cosine’
    Given the user is on the Wikionary home page
    When the user looks up the definition of the word ‘cosine’
    Then they should see the definition ‘In a right triangle, the ratio of the length of the side adjacent to an acute angle to the length of the hypotenuse.’

    ———-

    @dryrun is a sample filter. You can pick any filter of your choice. It makes sense to use meaningful words if you are grouping stories. For example, @billing for all billing related stories and scenarios.

    Now, add the filter to the run configuration in Eclipse to run the story.

    Right click >> Run as >> Run Configuration >> Maven build

    Filter Stories
    Filter Stories

    Add the goals to filter:

    verify -Dmetafilter=”+dryrun”

    Click on Run.

     

    View or verify the report for the story.

     

    Command line:

    /> mvn clean verify -Dmetafilter=”+dryrun”

    In this approach you save a lot of time verifying your automation results especially when you are automating new stories and scenarios. In this use case you are not interested about the other stories in the project. The main focus is your newly added automation story verification.

    More Info:

    https://jbehave.org/reference/latest/meta-filtering.html

     

    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

    ‹ Most Commonly used JBehave Annotations› Adding Stories to JBehave project

    Recent Posts

    • ChatGPT Subscription Plans
    • Stellar Converter for Database
    • Stellar Log Analyzer for MySQL
    • Stellar Repair for MySQL
    • ChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI Features
    • Shaping the Future of Development: Exploring Key Trends in Software Engineering
    • Improving Java Performance with Multithreading
    • Open-source Vector Databases

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com