Skip to main content

Running API tests with Serenity

Serenity BDD is an open source library that aims to make the idea of living documentation a reality. It also uses the test results to produce illustrated, narrative reports that document and describe what your application does and how it works.

Getting Started

This page explains how to setup the API testing framework built with Java and Serenity BDD.

Prerequisites

Set an environment variable BASE_URL (e.g. if testing locally set it to http://localhost:9000) or use the export BASE_URL=http://localhost:9000 command.

Running the tests

To run all tests please navigate to ./api-tests path and execute the following command:

./mvnw clean verify

To run the Smoke tests independently, use:

./mvnw clean verify -Dcucumber.options="--tags @Smoke"

To run the Functional tests independently, use:

./mvnw clean verify -Dcucumber.options="--tags @Functional"

To run tests by other tags and ignore tests that contain @Ignore tags use:

./mvnw clean verify -Dcucumber.options="--tags ~@Ignore --tags @YourTag"

Test Report

As a result of the test execution - serenity-maven-plugin will automatically generate the test report - ./api-tests/target/site/serenity/index.html.

Note

To manually aggregate the Serenity report execute the following command under ./api-tests directory:

 ./mvnw serenity:aggregate