Create Serenity JBehave project from command line.

Introduction

In this tutorial, let us see how to install the Serenity JBehave project from the command line using Maven. Tools required for this are: Maven, Eclipse, and m2e ( Maven plugin)

Requirements

Install Eclipse

Maven

Setting up Maven

Maven Integration plugin : m2e

Let’s start

First things first, create a directory for your project.
For example c:\SerenityProject

Change directory to the folder.

Issue the following command to generate the Serenity JBehave project from archetype.

mvn archetype:generate -Dfilter=net.serenity-bdd:serenity-jbehave-archetype

 

Enter project details like artifactId,groupID etc.

Install Log:

[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: remote -> net.serenity-bdd:serenity-jbehave-archetype (Serenity automated acceptance testing project using Selenium 2, JUnit and JBehave)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
Choose net.serenity-bdd:serenity-jbehave-archetype version:
1: 1.0.2
2: 1.0.6
3: 1.0.7
4: 1.0.8
5: 1.1.7
6: 1.1.17
7: 1.1.18
8: 1.1.19
9: 1.1.20
10: 1.1.36
11: 1.1.38
12: 1.2.0
13: 1.5.4
14: 1.6.9
15: 1.7.0
16: 1.8.4
Choose a number: 16: 16
Define value for property 'groupId': com.testingdocs.serenity
Define value for property 'artifactId': SerenityJBehaveProject
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' com.testingdocs.serenity: :
Confirm properties configuration:
groupId: com.testingdocs.serenity
artifactId: SerenityJBehaveProject
version: 1.0-SNAPSHOT
package: com.testingdocs.serenity
Y: :
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: serenity-jbehave-archetype:1.8.4
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: com.testingdocs.serenity
[INFO] Parameter: artifactId, Value: SerenityJBehaveProject
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: com.testingdocs.serenity
[INFO] Parameter: packageInPathFormat, Value: com/testingdocs/serenity
[INFO] Parameter: package, Value: com.testingdocs.serenity
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: groupId, Value: com.testingdocs.serenity
[INFO] Parameter: artifactId, Value: SerenityJBehaveProject
[INFO] Project created from Archetype in dir: C:\SerenityProject\SerenityJBehaveProject
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

 

 

Import the project

Now Import the project into Eclipse IDE.

Launch Eclipse >> File >> Import…

 

 

In Import Wizard select >> Existing Maven Projects

Click on Next> button.

Browse and select the Serenity Projects directory.

Click on the Finish button.

Eclipse would set up the project.

 

 

It may take a while to download all the dependencies. Please be patient.

Once the project is created in Eclipse, you can start working on the project. Note that the project created is a default general project. You have to work on the project as per your automation needs.

See also:

If you are comfortable with creating projects with an IDE:

JBehave Serenity BDD project