TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • TestNG
  • Tools
    • 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

  • Antivirus Products for Windows 11 PC
  • Install CodeBlocks IDE on Windows 11
  • Location Privacy Settings on Windows
  • Windows 11 Virus & Threat Protection
  • Download & Install Python on Windows 11
  • Cumulative Update for Windows 11 Version
  • Test execution speed in Selenium IDE
  • Check Windows 11 Free Upgrade
  • Download IntelliJ IDE on Windows 11
  • New MySQL Connection in Workbench

Back to Top

Automation Tutorials

  • JBehave Tutorial
  • Selenium Tutorial
  • TestNG Tutorial
  • JUnit Tutorial

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version