JBehave Interview Questions
- 1) Explain what is JBehave?
- 2) Enlist the major features of JBehave?
- 3) List different typs of modules in JBehave?
- 4) What are annotations in JBehave?
- 5) How to run multiple stories in JBehave?
- 6) How to get scenario name in JBehave?
- 7) What are JBehave optional parameters?
- 8) Explain the programmatic lifecycle of jbehave?
- 9) What is meta filtering in jbehave?
- 10) What is the use of @skip in jbehave?
- 11) List the major keywords used that are used in featured file?
Below are the list of Best JBehave Interview Questions and Answers
JBehave is a software-based in java language for Behaviour Driven Development (BDD). It is developed to make practices such as test-driven development(TDD) and Acceptance-driven design(ATD) which are an expansion of Behaviour-driven development(BDD), more accessible for the newcomers as well as experts. It also supports creating custom data types. It is purely a java implementation that works well with java enterprises.
The following are the features of Jbehave:
- It has the feature of Ant integration which gives its stories an advantage to run via an Ant task.
- User stories can be written in JBehave syntax and Gherkin syntax.
- While specifying the number of concurrent threads, users' stories can be executed concurrently.
- The user's stories can be specified as classpath resources or external URL based resources.
- By Maven Integration, user's stories are allowed to run via Maven plugin at any given build phase.
The following are the different types of modules in JBehave are:
- Game of life: used to verify multi-line scenarios behavior
- Gherkin: it verifies to pass gherkin based features
- Groovy: verifies groovy based behavior for writing steps.
- JRuby: Verifies JRuby behaviors
- Performance: verifies performance behavior
- Spring Security: verifies spring-based security behaviors
- Scala: verifies scala based behaviors
- Google: verifies to retrieve stories from google docs
- Rest: verifies to retrieve stories from rest APIs
- Threads: verifies multi-threading behaviors
Jbehave supports the following annotations:
To run multiple stories in JBehave, you can use the Ant task or Maven task. But you need to specify your story's location and which configuration should be used for its execution.
There are simple steps for you to follow to run your stories in JBehave.
- Write a story
- Map the steps in the story to java code
- Run jBehave tests
- Review test results
For this you need to create a new class which extends org.ibehave.core.reporters.consoleOutput and then you can modify various methods. After this, you need to create a new instance of abstract class and then you need to add the format of your story builder which you are using in your configuration.
JBehave optional parameters are Tabular parameters and parameter injection including a subdivision of ordered parameters, Annotated named parameters, para name named parameters.
JBehave mainly supports two ways to control the lifecycle of a story.
Programmatic lifecycle controls are code-centric. It is best suited for technical instead of functional controls. The @BeforeScenario and @AfterScenario allow the corresponding methods to be executed before and after each scenario. The @AfterStory allows the settings of an optional outcome which specifies whether the method should be executed depending on the outcomes of the scenarios.
A meta filter is represented as a string and supports multiple languages used based on the prefix used. JBehave supports meta tags to give you the benefit of marking some set of tests as p1 tests. It also includes running the tests include/exclude to p1 tests. Upon running stories you can easily see that one story file is excluded by the meta filter.
Now when you open the results folder the marked story marked as p1 has run but the stories got excluded and haven’t run.
It is used to skip the kind of story that you don’t want to execute in your program. By using the meta filter 'Skip' you can easily skip the files you don’t want.
The primary keywords involve Feature, Rule, Example, Given, When, Then, And, But(Steps), Background, scenario outline, and Examples.
Subscribe Our NewsLetter
Never Miss an Articles from us.
- Common Interview Questions
- Python Flask Interview Questions
- NoSQL interview questions
- JQuery Interview Questions
- C programming interview questions
- AngularJS Interview Questions
- Node JS Interview Questions with Express
- Core Java interview questions
- HTML Interview Questions
- Laravel interview questions
- Wordpress Interview Questions
- PHP Interview Questions