How to pass user defined parameters from command line


#1

Katalon has some defined properties that you can set the value to be pass as parameters from the command line. However, how do you defined and pass user-defined parameters into katalon. Example, i want to use and pass a variable such as MYCONFIGFILE=test-aws.json into katalon so that inside my code, I can set that value to be used inside my script. Any ideas?


#2

ty said:

Katalon has some defined properties that you can set the value to be pass as parameters from the command line. However, how do you defined and pass user-defined parameters into katalon. Example, i want to use and pass a variable such as MYCONFIGFILE=test-aws.json into katalon so that inside my code, I can set that value to be used inside my script. Any ideas?

Hello Ty,

Currently, Katalon Studio doesn’t support passing defined parameters from the command line into Katalon Studio. I have logged this request to the development queue for further discussion.

If you have any further inputs, feel free to add so Katalon team better understand the brought value.

Thank you for using Katalon Studio,
Liam


#3

By allowing user to passed in user defined parameters, this will support scenario where the user wants to pass in a parameter to be used inside the scripts. By the same convention already used, the solution would either allow users to define their own parameters via command line or as part of the properties file. Once the parameter is defined, then have a way to access that parameter inside the script.


#4

We currently work around this by assigning Global variables to parameters and then just modifying the values of the GlobalVariables.glbl file in the project folder before running the tests. Not sure if that helps.


#5

We’re currently evaluating Katalon. The location of our AUT does change, so I did create a Global-Variable called rootUrl. I would like to set the value from the command line (maybe something like this “katalon … /set:rootUrl=https://stagingServer:4322” to enable our build server to handle different urls.
Is this possible somehow? Can I use some other mechanism to do this?

Cheers,
Manuel


#6

I am also in need of this feature. Currently I replace `GlobalVariables.glbl` to work around this limitation, but a more straightforward way to pass parameters to the test suite will be much appreciated


#7

+1 As evidenced in this thread, too:


#8

+1


#9

+10 :slight_smile:
Ideally, we could set all global variables via command line execution…
something like this…
katalon -noSplash -runMode=console -projectPath=“C:\Workspace\ABCTest\ABCTest.prj” -retry=0 -testSuitePath=“Test Suites/QuickTests” -browserType=“Chrome” -gURL=“http://10.10.10.10” -gTitle=“Passing Parameters from Jenkins to Katalon”

where gURL and gTitle would be already defined global variables.


#10

Hey guys,

As this feature request getting more traction, I will bring it up again with the team for sooner consideration. We actually have planned this feature in our roadmap.

Thank you for choosing and supporting Katalon products,
Liam


#11

+1
Yes ! I do need to pass parameters as I do with Maven : -Dtest.environment=SIT

This would be perfect.


#12

I would still like a clean support from Katalon Studion on this but in the meantime this is a solution we have (and it works pretty nicely) and maybe some can find it useful.

For example if we need to inject new test host (IP) address during Jenkins execution we do following.
1. Create a Test Case (TC) that takes parameters. (local variable: BASEURL)
2. Create a simple CSV data source file (inputDataFile.csv) with header BASEURL and maybe default value.
3. Create a Test Suite (TS) and add our TC into the TS. Bind TC to data source from 2.

Then as a part of Jenkins execution, before we execute our tests, we delete the inputDataFile.csv and we create a new one like this: (IP address is the new IP address we got from Jenkins)

  sudo echo BASEURL  >./FILELOCATION/inputFile.csv ;  sudo echo http://192.227.63.72/ >>./FILELOCATION/inputFile.csv ; 

and then we run the tests. Test will bind to a new value and it executes properly.

Of course, this way you can add as many parameters as you need to your test case.

Rasko


#13

Please have a look at this:

Hope this helps.


#14

Please have a look at this:

Hope this helps.


#15

Rasko Pjesivac said:

+10 :slight_smile:
Ideally, we could set all global variables via command line execution…
something like this…
katalon -noSplash -runMode=console -projectPath=“C:\Workspace\ABCTest\ABCTest.prj” -retry=0 -testSuitePath=“Test Suites/QuickTests” -browserType=“Chrome” -gURL=“http://10.10.10.10” -gTitle=“Passing Parameters from Jenkins to Katalon”

where gURL and gTitle would be already defined global variables.

Hi Rasko, I tried this appoach by passing global variables via command line, however the global variables are not actually updated in the Project. The katalon user guild for command line also does not mention passing properties with -g notation. Would be a good approach if this works.


#16

Here is my approach to the same issue:
https://forum.katalon.com/discussion/5796/command-line-argument-dkatalon-user-home-xxxx

I hope a single option -Dkatalon.user.home= supported by future Katalon Studio Console Mode

>.\katalon.exe -Dkatalon.user.home=C:\Users\myname\tmp\blue ...

in the properties file you want to write whatever parameters you like:

GlobalVariable.URL=http://10.10.10.10
GlobalVariable.Title=Passing Parameters from Jenkins to Katalon

In the TestLister, you can write code to load the properties and overwrite the Global variables yourself. My post describes how I implemented this.

https://forum.katalon.com/discussion/5780/katalon-properties-file-and-jvm-system-property-katalon-user-home


#17

Hello, just another +1 from us. We need this feature to be able to pass different variables from our CI environment to the test(s).


#18

Another +1


#19

kazurayam said:

Here is my approach to the same issue:
https://forum.katalon.com/discussion/5796/command-line-argument-dkatalon-user-home-xxxx

I hope a single option -Dkatalon.user.home= supported by future Katalon Studio Console Mode

>.\katalon.exe -Dkatalon.user.home=C:\Users\myname\tmp\blue ...

in the properties file you want to write whatever parameters you like:

GlobalVariable.URL=http://10.10.10.10

GlobalVariable.Title=Passing Parameters from Jenkins to Katalon


In the TestLister, you can write code to load the properties and overwrite the Global variables yourself. My post describes how I implemented this.

[https://forum.katalon.com/discussion/5780/katalon-properties-file-and-jvm-system-property-katalon-user-home](https://forum.katalon.com/discussion/5780/katalon-properties-file-and-jvm-system-property-katalon-user-home#latest "Link: https://forum.katalon.com/discussion/5780/katalon-properties-file-and-jvm-system-property-katalon-user-home#latest")  

  

Here, katalon.user.home will have path to the blue environment file and value from this file will be over written to global variables …correct?


#20

krishnaprasad,

Here, katalon.user.home will have path to the blue environment file and value from this file will be over written to global variables …correct?

Yes, you understand correctly what I hoped at March 2018.

Let me note:

  1. In April 2018, Katalon Studio 5.4.0 introduced the -executionPropfile= switch as described at https://docs.katalon.com/display/KD/Console+Mode+Execution
  2. Katalon Studio 5.4+ does NOT support the -Dkatalon.user.home= switch which I proposed.

Both ideas (-executionProfile and -Dkatalon.user.home) intended to implement a feature of overwriting global variables dynamically at runtime. These 2 approaches are similar, but not identical. The -executionProfile approach requires the new settings is still managed by Katalon Studio. The -Dkatalon.user.home approach accepts the new settings from anywhere: out of Katalon Studio’s control.The Katalon team has chosen the -executionProfile approach and I respect it.