Install TestCafe in Ubuntu 18.04

Install TestCafe in Ubuntu 18.04

Lately, I have been playing a lot with TestCafe which is a testing tool for website, there are 2 parts of TestCafe, the first part is TestCafe studio which is a tests editor tool where you can create or edit new tests that will be eventually used in the TestCafe test runner, both TestCafe and the test runner runs on Windows, MacOS, and Linux.

So what we are going to do today is to install TestCafe on Ubuntu Linux 18.04, in this tutorial we will only install the test runner because, in the end, my main goal is to use TestCafe to emulate the load on a server, so let’s get started

First, we need to install NodeJS and NPM, this is kind of tricky depending on your OS version, for example, if you run this command :

sudo apt -y install nodejs

in Ubunto 18.04 you will end up installing NodeJS version 8 something… that’s too old for what we need to do, so first let’s install the latest version of NodeJS, in this case, this is version 12

Installing NodeJS and NPM

1) First, let’s update our repository information

sudo apt update
sudo apt -y upgrade

2) Manually add Node.js APT Repository


sudo apt update
sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

3) now let’s install NodeJS

sudo apt -y install nodejs

4) This step is optional, if you want to verify the versions of NodeJS and NPM you can use the following commands:

node --version
npm --version

 

Installing TestCafe

To install TestCafe you only need to execute one command, so here it is

npm install -g testcafe

That was easy !!!

That is everything for this post, see you!!!