After looking everywhere for an excellent test suite and coming across Selenium, UFT, Waitr, TestComplete and few others, finally we have found a fantastic product to run our integration test, a product that I highly recommend to any QA lover that want simplicity but at the same time the possibility to write code and fully customise your testing.
It’s a free product; you can download at https://www.katalon.com/katalon-studio/ and is promise is:
A simple and powerful automation solution. A viable alternative to costly commercial automation solutions
Apart from the marketing slogan, I never see a product so easy to use and completely free! It comes with a recorder that will convert the action in the groovy script, easily modifiable afterwards with a user-friendly interface.
Install Katalon and create your first project
The first step is to set up an account at https://www.katalon.com/ (consider that the username and password will be exposed on your Jenkins box too) and download and install Katalon studio. Open Katalon and create a New Project:
Follow the simple three steps to create your first automation test:
After you are done with these three steps: CONGRATULATIONS, your first automation test is up & running.
For the sake of this lecture, I will omit the creation of the test suit, but you can find all the examples and documentation on the product’s website.
At this stage there is a little gotcha using the chrome driver, they don’t support the WebUI.maximizeWindow(), you should use WebUI.setViewPortSize(Width, Height) when you are editing your script.
Download the Katalon Linux CLI on your computer, then copy it over your Jenkins box:
scp -i "<<KEY FOR THE BOX>>" Katalon_Studio_Linux_64-X.X.X.tar.gz your-username@jenkins-box-ip-address:/your-directory
Unzip the file and create a symlink so you can recall from any directory of the system. This trick will help you even in the case of an update.
tar -xvf Katalon_Studio_Linux_64-X.X.X.tar.gz
sudo ln -s /your-directory/Katalon_Studio_Linux_64-X.X.X/katalon /bin/katalon
Make sure that “your-directory” is accessible to your Jenkins user, in the case is not, make it available using this command:
sudo chown -R jenkins-user:jenkins-group /your-directory
Configure Jenkins (Install XVFB)
- Install this plugin: https://wiki.jenkins.io/display/JENKINS/Xvfb+Plugin
- After you’ve installed it, go to your Job, check “Start Xvfb before the build, and shut it down after.” and use these settings in ‘Xvfb additional options’ field of this plugin:
We do need Xvbf (X Virtual Framebuffer) because usually, servers, doesn’t have any display attached and the headless driver is not supported at this stage from the Linux CLI. In summary: It enables you to run graphical applications without a display.
Copy your Katalon Studio project across or use git
Using git will be the best option because as shown below, we can setup Katalon to interact directly with it.
Inside Katalon, you can find the git icon, and from there you can manage your repository and be able to push the changes to Github/Bitbucket/etc. Then your Jenkins box will update the repo automatically on the machine, and you will be able to run the latest test that you wrote in a matter of a click!
Configure Jenkins (Install ChromeDriver)
In my case, I’m using an Ubuntu box; therefore, this step will be different on a distinct operating system.
sudo apt-get install chromium-chromedriver
sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/bin/chromedrive
Configure Jenkins (Create a Job)
Create a Job (New item) → Enter the item name as Freestyle project
This will create an item in your tab that will look like this:
Save it, and you will be redirected to the configuration screen:
This is the part where we need to configure the Xvbf plugin that we set before. It’s essential to specify the Xvbf Screen and the “Delete workspace before build starts”. We use the Xvbf screen parameters later on when we write the Katalon scripts.
And on the build you should insert this:
katalon -noSplash -email="your-email" -password="your-password" -runMode=console -consoleLog -projectPath="/directory-of-your-project/your-project.prj" -retry=0 -testSuitePath="Test Suites/your-test-suite" -browserType="Chrome"
Run the test
Everything is set up. Press Build Now!
Let the magic happen and wait for the report to be sent to your email.
Are you test failing? No problem, Katalon can include a screenshot in the report!