Assume you have a clean PC without any developer tools. How quickly can you install all the required testing tools, write and run your first functional test for the web? An hour? Or two?
We at TestCafe think that 5 minutes is more than enough. Seriously.
Start your timer and follow the steps below.
A Windows (Mac or Linux) computer and internet connection.
Now, your machine is ready to install TestCafe. You can do it from the Node.js package manager (npm) with a single command. Open the console, type in the following text and press Enter:
npm install testcafe -g
Let’s write a test. All you need is your favorite text editor. In the example below, we will check whether Google ranks the TestCafe GitHub repository first when searching for “TestCafe on GitHub“.
test.js file in
D:\test with the following code:
There is absolutely no magic here.
Everything is ready to start the test:
Go to directory
D:\test in the console and write a command to open browsers and start the test:
testcafe chrome test.js
Wait until testing is successfully complete and study the test result.
Of course, the amount of time spent at each step can be different depending on the performance of the machine and the Internet connection speed.
However, we have completed this tutorial in 4 min 45 sec. And we still have extra 15 seconds :)
You can run this test in 3 other ways:
testcafe firefox test.js;
testcafe remote test.js;
testcafe remote test.js — qr-code.
So, you have spent less than 5 minutes to write your first test. And this is just the beginning because TestCafe has much more useful features to surprise you.
Create your free account to unlock your custom reading experience.