Test Automation and CI using Serenity BDD & Jenkins for an Oracle ADF Application: Part 2 of 5

Serenity BDD: What is it? Where is it used?

Serenity BDD is an open source library that helps developers and testers write maintainable automated acceptance and regression tests faster. It also uses the test results to produce illustrated, narrative reports that document and describe what your application does and how it works. A developer can build Serenity test suites using Maven, Gradle, or Ant. Serenity BDD provides strong support for automated web tests using Selenium 2. To learn more about the basic concepts of Behaviour Driven Development or BDD please refer to the link below.


In this blog series we explain how to

Part 1: Install Serenity BDD and configure the environment
Part 2: Build sample Serenity project/test suite using maven
Part 3: Configure an existing ADF Application using maven
Part 4: Create Serenity test suite for the maven-based Oracle ADF application
Part 5: Continuous Integration of Serenity test suite using Jenkins

PART 2: Build sample Serenity project/test suite using maven

Create a new maven project (or import the existing if you already have one). I have attached the sample maven project, download and import it to run and check if the installations, setup was done correctly.

Download the zip file (Install_Check_Sample.zip) and unzip to a location where you have your Eclipse projects are saved.
Open Eclipse IDE select import from the File drop down as shown below File>Import

Select Existing Maven Projects in the popup and click Next

Enter the location of the Maven project, select the pom.xml checkbox and click on Finish.

Once the Sample Maven project is imported the project structure looks like below

Add dependencies in pom.xml file (if project is imported pom.xml already exists, ignore this step). The attached sample test suite has the below pom.xml, added detailed explanation of plugins.

Thucydides.properties / Serenity.properties File.

This file is used to setup the system properties, web drivers and their capabilities. I have the below setup for my sample project. The commented lines are for using IE explorer or firefox drivers.

Create java classes to start writing test cases( downloaded sample project will have the below) . I will explain how to structure and start coding the serenity tests using selenium commands in my next blog.

Run the java class/test case(with name ending in Test.java as specified in the pom.xml) as junit if you want to run the tests individually while unit testing as shown below.

Run the integration tests (all the tests in the test suite) using mvn verify command on cmd in the project folder to run the integration tests.
( ex: C:\SerenitySample mvn verify)

In this sample we are using Chrome driver. We cannot specify ‘webdriver.chrome.driver = C:\\chromedriver.exe’ in the properties file for iexplorer and firefox instead the driver location should be specified in the command line as shown below when executing tests.

mvn verify -Dwebdriver.ie.driver=C:\IEDriverServer.exe
mvn verify -Dwebdriver.gecko.driver=C:\geckodriver.exe

Below is the sample log which appears when the test suite is run successfully.

The test results are generated as a HTML report (Index.html) in the below location and are very descriptive in nature with screenshots. This is one of the main feature of Serenity BDD which make the testing process a living documentation.

C:\(Eclipse Workspace path)\FusionAppliedAutomation\target\site\serenity\Index.html

Below are the screenshots of the report generated for our sample project

Click on the Test name under tests to see the details steps being tested with screenshots, outcomes and duration took for the test to execute.

If you were able to see the generated reports saying tests result outcomes as SUCCESS, Congrats!! you have successfully setup Serenity and ran your first automated test.

Download Sample Project

hareesha muppalaneni

hareesha muppalaneni

Developer at Fusion Applied
Hareesha has more than 6 years of professional software development experience and has worked on developing solutions for federal agencies during her career. She is ADF 12C Certified Implementation Specialist and is experienced with agile software development techniques. Her current focus is building solutions using Oracle ADF 11g and 12c, Serenity BDD test automation and CI/CD.
hareesha muppalaneni

Leave a Reply

Be the First to Comment!

Notify of