How to use Katalon plugin for Jenkins on Ubuntu


#1

This tutorial will walk you through basic steps to run Katalon Studio’s web UI tests using our plugin for Jenkins on a headless Ubuntu machine i.e. a machine without any display.

If you are interested in using Docker images instead, please see https://github.com/katalon-studio-samples/ci-samples.

If you are using Windows or macOS we will have similar tutorials soon.

Install Jenkins

Please follow official instructions by Jenkins.

Install Google Chrome

wget -O google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt -y -f install

Install Xvfb

From Wikipedia:

Xvfb or X virtual framebuffer is a display server implementing the X11 display server protocol. In contrast to other display servers, Xvfb performs all graphical operations in virtual memory without showing any screen output. From the point of view of the client, it acts exactly like any other X display server, serving requests and sending events and errors as appropriate. However, no output is shown. This virtual server does not require the computer it is running on to have any kind of graphics adapter, a screen or any input device. Only a network layer is necessary.

sudo apt install -y xvfb

Install Katalon plugin for Jenkins

Go to Manage Jenkins > Manage Plugins > Available and find Katalon plugin on the list.

Create and configure a new Jenkins project

To keep it simple, I will use Freestyle project.

The sample Katalon Studio project can be cloned from Github.

Next, add and configure the build step Execute Katalon Studio tests provided by Katalon plugin for Jenkins.

  • Katalon Studio will be downloaded and installed automatically based on the version you specify.
  • Please leave out -runMode in the arguments list.
  • If you want to learn more about xvfb-run configuration please see its manual. If you are not sure, only change the resolution 1024x768x24 and leave other options as-is.

If for some network conditions the Katalon Studio package cannot be downloaded, you can install it manually and specify its location.

me@ubuntu:~$ sudo su
root@ubuntu:~$ su jenkins
jenkins@ubuntu:~$ wget https://github.com/katalon-studio/katalon-studio/releases/download/v5.10.1/Katalon_Studio_Linux_64-5.10.1.tar.gz
jenkins@ubuntu:~$ tar -xzf Katalon_Studio_Linux_64-5.10.1.tar.gz
jenkins@ubuntu:~$ cd Katalon_Studio_Linux_64-5.10.1 && pwd

The last command will print the location you need (/var/lib/jenkins/Katalon_Studio_Linux_64-5.10.1).

Run, Katalon, run!

Go to the Jenkins project page (e.g. at http://localhost:8060/jenkins/job/test/ if its name is “test”), click Build Now.

After it finished, you can find the report in the Last Successful Artifacts section.

Advantages

  • It’s quick and easy - you won’t even have to install Katalon Studio manually
  • It works even on machines without displays.
  • Allocating an isolated virtual display for each Jenkins build increases the stability of execution.

Katalon plugin for Jenkins - In which directory do I put Katalon.tar.gz?
Jenkins Plugin - +x permissions are not applied to Katalon executable
Issues in running Katalon Test suite with Jenkins CI
Jenkins and Docker - Run Katalon - error: JVM terminated. Exit code=13
The first release of Katalon Studio's Jenkins Plugin
What virtual machine is being used for remote execution?
#4

If you are using Windows or macOS we will have similar tutorials soon.

——When will you offer the macOS tutorials?
follow the old tutorial(https://docs.katalon.com/katalon-studio/docs/jenkins-integration.html), I run Katalon testsuits/testcollection by jenkins on macOS , and come across a lot of problems.


java.lang.NoClassDefFoundError: Could not initialize class com.kms.katalon.core.webui.keyword.builti
#6

Thanks for the guide - I’m seeing an error related to Chrome not properly starting when trying to call openBrowser("") as follows:

21:15:47 2019-02-06 21:15:47.406 DEBUG testcase.Root user login                 - 1: System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome")
21:15:47 2019-02-06 21:15:47.409 DEBUG testcase.Root user login                 - 2: openBrowser("")
21:15:48 2019-02-06 21:15:48.203 INFO  c.k.k.core.webui.driver.DriverFactory    - Starting 'Chrome' driver
21:15:48 2019-02-06 21:15:48.256 INFO  c.k.k.core.webui.driver.DriverFactory    - Action delay is set to 0 seconds
21:15:49 Starting ChromeDriver 2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d) on port 9914
21:15:49 Only local connections are allowed.
21:15:50 2019-02-06 21:15:50.158 ERROR c.k.k.core.keyword.internal.KeywordMain  - ❌ Unable to open browser with url: '' (Root cause: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
21:15:50   (unknown error: DevToolsActivePort file doesn't exist)
21:15:50   (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
21:15:50   (Driver info: chromedriver=2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d),platform=Linux 4.4.111+ x86_64) (WARNING: The server did not provide any stacktrace information)
21:15:50 Command duration or timeout: 417 milliseconds
21:15:50 Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:07:36.161Z'
21:15:50 System info: host: '<host>', ip: '<IP>', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.111+', java.version: '1.8.0_181'
21:15:50 Driver info: driver.version: CChromeDriver)
21:15:50 2019-02-06 21:15:50.166 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ openBrowser("") FAILED.
21:15:50 Reason:
21:15:50 com.kms.katalon.core.exception.StepFailedException: Unable to open browser with url: '' (Root cause: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
21:15:50   (unknown error: DevToolsActivePort file doesn't exist)
21:15:50   (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
21:15:50   (Driver info: chromedriver=2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d),platform=Linux 4.4.111+ x86_64) (WARNING: The server did not provide any stacktrace information)
21:15:50 Command duration or timeout: 417 milliseconds

Any idea why this could be happening?


#7

@devalex88 Waiting for the Windows tutorial :slight_smile:


#8

Is your Chome installed in this location: /usr/bin/google-chrome? Please double check once again this location.


#9

Is there any update on windows tutorial?


#10

Please share the windows tutorial …


#11

@Vinh_Nguyen Great Plugin.

But it would like to know how can we parameterize the “Command Arguments” field.

Like for example if below is the command:-

-retry=0 -testSuitePath=“Test Suites/H1” -executionProfile=“live” -browserType=“Chrome”

Now how can I parameterize the >-executionProfile="live" to something like >-executionProfile="${env}"

and the value will be coming from Jenkins build parameters


#12

I pull a project from Git to run test on Jenkins using Katalon plugin. On the console output, it says

Opening project file: /home/admin/workspace/Katalon_Test_Automation
Invalid argument: Cannot find project ‘/home/admin/workspace/Katalon_Test_Automation’.
Build step ‘Execute Katalon Studio Tests’ marked build as failure
Notifying upstream projects of job completion
Finished: FAILURE

But when I check, the directory ‘/home/admin/workspace/Katalon_Test_Automation’ does exist (I can cd to it). Could you help me solve this please?


#13

Hi, I’m getting the exact same error.
I can confirm that google-chrome is installed to /usr/bin/google-chrome

Update (after a tiny bit of research):
the google chrome error is caused by
(unknown error: DevToolsActivePort file doesn’t exist)
which is a xvfb error

The command argument I used was
-a -n 0 -s “-screen 0 1024x768x24”

Still not sure how to fix it though?


#16


@devalex88 Test Suites execution is successful, but a build failure is indicated.

Please help me