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

    JBehave

    Filtering stories with Meta Filters

    JBehave

    Introduction

    In this post, we will discuss filtering stories with meta filters with a simple example. When we have a bunch of stories and we want only some stories to run based on meta-information. In this example, we will see how to filter stories from within code.

    Meta Information

    For example, we have 2 stories with different meta information marked as P1 and P2 as shown below:

    StoryOne is p1

    Meta:
    @P1

    StoryTwo is p2

    Meta:
    @P2

    Meta Filters

    However, we want to run only one story which is marked with priority P1. JBehave supports meta tags so that you can mark some set of tests as P1 tests. Also, we can instruct JBehave to run the tests, include/exclude only the P1 tests. Furthermore, we can do this in many ways. In this post, we will see how to perform this from within the code.

    Using the below filter would run only the tests marked as P1.

    metaFilters={“+P1”}

     

    Sample code listing

    @RunWith(value=AnnotatedEmbedderRunner.class) 
    @UsingEmbedder(embedder=Embedder.class,
                   metaFilters={"+P1"}
                    )

     

     

    When we run the stories, we can see that one story file is excluded by the meta filter as shown below:

     

    JBehave_MetaFilter2

     

    Open the results folder we notice that the story marked as P1 has run and the other story got excluded and has not run.

    Jbehave_StoryReports

     

    In the next post, we will see how to filter stories using JBehave maven plugin.

     

    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

    ‹ Annotated @Named Parameters Example› Understanding Meta Tag Information

    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