Runtime dependencies

Node.js

Serenity/JS is a Node.js program. To help ensure maximum stability, it relies on a recent (>= 10) Long-Term Support (LTS) version of the Node.js platform.

You can get both Node.js and the Node Package Manager (npm) either from the nodejs.org website, which provides convenient installers for all the major operating systems, or using the Node Version Manager (nvm). The second option is more appropriate if you need to work with several versions of the Node.js platform simultaneously.

To check if you machine is set up correctly, execute the following command in your terminal:

$ node --version
v12.18.4

A Node.js project

Serenity/JS is typically installed as a dev dependency of a Node.js project, so that it doesn't get accidentally bundled together with your production dependencies.

If you're introducing Serenity/JS to an existing project you can skip this section as its purpose is to help you create package.json - a Node.js project descriptor file, which would already be part of your project.

To create a Node.js project from scratch, create a new directory, such as example, and initialise a new project accepting the default configuration suggested by the npm with these terminal commands:

$ mkdir example
$ cd example
$ npm init

Your actions should result in a basic package.json file appearing under example, with contents similar to the following:

{
  "name": "example",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Java Runtime Environment

Serenity/JS delegates the work of generating the illustrated HTML reports to Serenity BDD, which is a Java library and therefore requires a Java Runtime Environment (JRE) version 8 or newer.

You can download the JRE from oracle.com, adoptopenjdk.net, or by using the excellent Software Development Kit Manager (SDKMan)

To verify that you have the JRE installed, execute the below command in your terminal:

$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

If you're working with several versions of the Java platform simultaneously, please make sure that you point your JAVA_HOME environment variable to the correct version.

On MacOS this could be:

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home

Please consult the Oracle documentation for more details.

A web browser

If you're planning to make your acceptance tests interact with a web interface, you'll also need a web browser. Google Chrome is a great one to start with.