Headless execution

Hi,

We are trying run Katalon test script on headless enviroment as part of our CI process, we use following command that I generated from Katalon Studio

./katalon -noSplash  -runMode=console -projectPath="/katalon/katalon/project/eChequesBank.prj" -retry=0 -testSuitePath="Test Suites/Testkatalon" -browserType="Chrome (headless)"

But it keeps throwing java.awt.HeadlessException, below is the full log:

Starting Groovy-Eclipse compiler resolver.  Specified compiler level: unspecified
133 2.4.7.xx-201611170128-e46 = ACTIVE
Request sent successfully.
/%katalon%katalon%project%eCheques Bank.prj/Keywords/com/sts/qc/testing/JsClick.groovy: 24 Groovy:unable to resolve class internal.GlobalVariable
--------------------------------------------------------------------------------
Test Suites/Testkatalon - Chrome (headless) - 20180515_135542............0/1(0%)
--------------------------------------------------------------------------------
Request sent successfully.
05-15-2018 01:55:45 PM - [START]  - Start Test Suite : Test Suites/Testkatalon
05-15-2018 01:55:45 PM - [RUN_DATA] - Logging run data 'hostName' with value 'root - 16bd6eb35a80'
05-15-2018 01:55:45 PM - [RUN_DATA] - Logging run data 'os' with value 'Linux 64bit'
05-15-2018 01:55:45 PM - [RUN_DATA] - Logging run data 'hostAddress' with value '172.17.0.6'
05-15-2018 01:55:45 PM - [RUN_DATA] - Logging run data 'katalonVersion' with value '5.4.1.1'
05-15-2018 01:55:46 PM - [START]  - Start Test Case : Test Cases/Test katalon
05-15-2018 01:55:46 PM - [INFO]   - Evaluating variables for test case
05-15-2018 01:55:46 PM - [START]  - Start action : openBrowser
05-15-2018 01:55:47 PM - [END]    - End action : openBrowser
05-15-2018 01:55:47 PM - [ERROR]  - Test Cases/Test katalon FAILED because (of) java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
05-15-2018 01:55:47 PM - [END]    - End Test Case : Test Cases/Test katalon
05-15-2018 01:55:47 PM - [END]    - End Test Suite : Test Suites/Testkatalon 
--------------------------------------------------------------------------------
Test Suites/Testkatalon - Chrome (headless) - 20180515_135542..........1/1(100%)
--------------------------------------------------------------------------------

We could solve this issue by outputing to Xvfb as following:

Xvfb :0 >& /dev/null &DISPLAY=:0export DISPLAY

But I am not sure if this the right way, is not setting -browserType=“Chrome (headless)” should solve this without need to output to Xvfb?

Regards,

Omar

2 Likes