Getting started with CodeceptJS – Modern era acceptance testing – Part 1

We are going to run through the initial setup for CodeceptJS, begin by writing some simple tests and get them up and running with a few different testing frameworks.

So to get started let’s create our CodeceptJS directory and install the relevant npm packages.

cd C:
mkdir codeceptjsdemo
cd codeceptjsdemo
npm install -g codeceptjs

Next we will initialize CodeceptJS, which will create our codecept.json config file. We will be asked a few questions based on the frameworks and setup we would like to use.

codeceptjs init

For this example I’ve selected WebDriverIO (use the space-bar to select multiple options from the command line), and for all of the other options we will be using the default selections. The baseurl I selected was, so we can start writing some tests for that page.

Before we start writing tests, I would suggest installing a code editor if you don’t already have one installed. My personal preference is Visual Studio Code which has some nice intellisense options, file explorer and command line all in one, so we don’t need to leave the application when writing tests.

If we open up our initial directory in VS Code, we should have something which looks like this.

Now we have everything installed and the initial project setup, we can start writing tests. See part 2, where we will run through the commands needed to generate tests, explore the project structure, and run our tests with multiple frameworks.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s