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

JBehave

JBehave MostUsefulConfiguration

JBehave

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

‹ Running JBehave Stories : JUnitStory and JUnitStories› Examples Table: Repeating a Scenario

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