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

JBehave MostUsefulConfiguration

Tweet
Pin it

Document Contents

  • Introduction
  • Configuration Abstract class
  • Class Diagram
  • Sample code snippet

Introduction

In this post, we will discuss JBehave MostUsefulConfiguration. MostUsefulConfiguration is the configuration that works for most situations that we are likely to encounter. Most of the elements configured with this configuration. However, we can change these configuration elements if we don’t like the default ones. It extends from an abstract class Configuration.

Configuration Abstract class

The Configuration class is used by the Embedder and the in the Embeddable implementations to customize it’s runtime properties. It implements a Builder pattern so that each element of the configuration can be specified individually, and read well. All elements have default values, which can be overridden by the use methods. The use methods allow to override the dependencies one by one.

 

Class Diagram

 

MostUsefulConfiguration

 

 

More Information here:

http://jbehave.org/reference/stable/javadoc/core/org/jbehave/core/configuration/MostUsefulConfiguration.html

 

If we need custom based components, we can extend Configuration to provide custom components.
For example:

public class CustomConfiguration extends Configuration { … }

Another example is SeleniumConfiguration. It extends Configuration to provide Selenium-based components. It can be used for both Selenium and WebDriver API as shown below.

public class SeleniumConfiguration extends Configuration {…

We may need to override the parent class method.

Sample code snippet

@Override
    public Configuration configuration() {
        return new SeleniumConfiguration()
                .useWebDriverProvider(driverProvider)
                .useSeleniumContext(seleniumContext).useFailureStrategy(
new FailingUponPendingStep())
                .useStoryControls(new StoryControls().doResetStateBeforeScenario(false)
.doIgnoreMetaFiltersIfGivenStory(true))
                .useStoryLoader(new LoadFromClasspath(this.getClass().getClassLoader()))
                .useStoryReporterBuilder(new MyStoryReporter()
                        .withCodeLocation(CodeLocations.codeLocationFromPath(getClassPath()))
                        .withDefaultFormats()
                        .withFormats(Format.CONSOLE, Format.HTML));
    }

 

 

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