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

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version