TestingDocs.com
Software Testing website
  • JBehave
  • Selenium
  • Testlink
  • Maven
  • Git
  • RAPTOR
  • Questions

Filtering stories with Meta Filters

Tweet
Pin it

Document Contents

  • Introduction
  • Meta Information
  • Meta Filters
  • Sample code listing

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

Tag Cloud

Agile Appium Tutorials C++ Eclipse Tutorials Git Tutorials IntelliJ Tutorials Java Java Tutorial JBehave Jenkins Jira Cloud JUnit Tutorial Maven Object-oriented Flowchart Python Tutorials Raptor Flowcharts Selenium IDE TestLink Tutorials

Random Posts

  • TestLink Bitnami Cloud Image
    Overview In this tutorial, we will see the steps

    Read more

  • Code Coverage Tools
    Overview Let’s look at some of the code coverage

    Read more

  • pCloudy Continuous Testing Cloud
    Overview pCloudy is a continuous testing cloud

    Read more

Latest Tweets

Tweets by @TestingDocs

Back to Top

TestingDocs.com

Privacy Policy

Cookie Policy

  • JBehave
  • Selenium
  • Testlink
  • Maven
  • Git
  • RAPTOR
  • Questions
www.TestingDocs.com | All Rights Reserved