4

In our Katalon Studio project we have a test case.

We like that test case to accept a parameter from the command line when running the test suite.

For example, we like to run the same test case one time with parameter=A and another with parameter=B.

This will enable our Jenkins to run different tests without the need to duplicate test cases again and again.

Is there a way to do it?

riorio
  • 5,015
  • 5
  • 29
  • 70

3 Answers3

3

Actually, you can't specify your parameters in the command line. But it seems to be in demand by the community (Katalon - How to pass user defined parameters from command line)

Solution :

You can define your parameters in profiles. Each profile can contains the same parameters with different values, and can be chosen during the Test Suite execution.

You can choose the profile you need manually or by passing it in command line. To do it you only have to use the -executionProfile option:

katalon -noSplash -runMode=console -consoleLog -noExit -projectPath="C:\MY_PATH" -retry=0 -testSuitePath="Test Suites/MY_TEST_SUITES" -executionProfile="Profile_A"

Finally, don't forget to convert your step input Variables into Global Variables where you need in your Test Case. You can do that manually or by script :

import internal.GlobalVariable as GlobalVariable
GlobalVariable.my_variable

docs: Katalon Docs - Execution Profile (v5.4+)

Hoping it will help you.

Marsso
  • 77
  • 1
  • 6
2

Like post above but in more way of showing where to look for the answers. After You open Your Project, look for Profile :

Where to look for profile

Need to add to your script(it should be added be default be still remember if you will get error about missing keyword)

Remember to add lib for GlobalVariable

You are ready to make your "Build CMD"

siranen
  • 374
  • 1
  • 11
0

From version 5.10, it is possible to override profile variables from the command line.

So, if you have a GlobalVariable.parameter=A as the default, you can add

-g_parameter=B

to the command line command to switch it to B.

Mate Mrše
  • 6,305
  • 6
  • 26
  • 53