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

JBehave

Running JBehave Stories : JUnitStory and JUnitStories

JBehave

JUnitStory

In this post, we will discuss running JBehave stories with JUnitStory / JUnitStories. It is a JUnit runnable entry-point to run a single story specified by a Embeddable class. JUnitStory is an abstract class and extends ConfigurableEmbedder.

public abstract class JUnitStory extends ConfigurableEmbedder { ….

 

 

Run JBehave Stories
Run JBehave Stories

JUnitStories

JUnit-runnable entry-point to run multiple stories specified by storyPaths(). It is similar to JUnitStory class.

public abstract class JUnitStories extends ConfigurableEmbedder { …..

 

The difference between the two is how they run Stories using the below statement:

embedder.runStoriesAsPaths(….);

 

run() method

To run the stories, we can either extend the abstract implementation of ConfigurableEmbedder,  which does not implement the run() method, or JUnitStory/JUnitStories. These classes implement run() using JUnit’s @Test annotation. However, we can also override these implementations of the run() method.

Sample code snippet

@RunWith(value=AnnotatedEmbedderRunner.class)
@UsingEmbedder(embedder=Embedder.class)
@Configure( storyReporterBuilder=MyReporter.class, storyLoader=MyStoryLoader.class)
@UsingSteps(instances={ MyStorySteps.class })

public class MyCustomStories extends JUnitStories {
    
    @Test
    @Override
    public void run() throws Throwable {
    
        // finding stories and running them 
        
    }

}

 

AnnotatedEmbedderRunner

AnnotatedEmbedderRunner is a JUnit Runner that uses the AnnotationBuilder to create an embeddable test instance.

public class AnnotatedEmbedderRunner extends BlockJUnit4ClassRunner {…..

AnnotationBuilder is a class that allows the building of Configuration, CandidateSteps, and Embedder from an annotated class as shown in above code snippet annotations.

 

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

‹ Configure JBehave Stories› JBehave MostUsefulConfiguration

Recent Posts

  • Update draw.io on Windows
  • 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