Site icon TestingDocs.com

JBehave + Serenity Sample Project

Overview

In this post, we would learn how to create a sample JBehave Serenity BDD project using Maven build tool. The quickest way to create a new automation project is to use Maven Archetypes.

Serenity BDD automation cycle:

 

BDD describes the process in which a customer uses the software under test or  application under test.( AUT). This enables the development team a detailed view of the application that they would build. BDD stories often called Gherkin are written in plain English.

A sample Google search story could be as shown below:

——–

Search a keyword
Narrative:
In order to search web
As a user
I want to search keyword on the internet

Scenario: Looking up the keyword of 'Lasagne'
Given the Google home page
When I search the keyword 'lasagne'
Then I should see 'lasagne' search result

——–

As you can see, the story has a Role , Feature and the Benefit that the application under test provides to the role. What we need to verify as an automation engineer.

Required Tools

NetBeans IDE, JDK, JBehave, Serenity , Maven

Automation Environment Setup

Steps:

Launch NetBeans IDE.
Create new project by clicking
New >> New Project…
Choose Maven and Project from Archetype.

Sample Serenity Project

In-case you don’t have Maven enabled in your IDE, you can enable it
Tools > Options > Java > Maven

Click on Next > button.
In the search box, enter serenity-jbehave keyword.
Select the serenity-jbehave-archetype option and click on the Next > button.

Enter Project Information and click on the Finish button.

Project should be created successfully.

So far so good, you should see the following Maven Output:

————————————————————————
BUILD SUCCESS
————————————————————————

In the projects explorer, you can find the artifacts created for you.

Hooray! You have created an automation project using JBehave and Serenity.

Next steps are to add stories, features, Steps and step definitions, run the stories and view results.

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

Exit mobile version