I am curious if anyone has figured out a way to pass Global Variables to be used within their CI/CD Pipeline.
Problem: I want to dynamically report to Katalon Test Ops the release version my test is running against
Idea:
** Create a test listener that automaically sets a global variable at the beginning of every test case with the correct release version based on the environment I am running against (I have already done this)
** Pass this global variable to my CI/CD pipeline so that results are reported against the correct release version. Example: katalonc.sh -runMode=console -browserType="Chrome" -statusDelay=15 -testSuiteCollectionPath="Test Suites/Full_Regression" -apiKey="$KATALON_API_KEY" -testOpsReleaseId={GLOBAL VARIABLE HERE} --config -webui.autoUpdateDrivers=true
I understand I am able to override Global variables from the command line, but I am trying to accomplish the inverse of this.
When you say a way to pass Global Variables to be used within their CI/CD Pipeline, you can think about 2 approaches.
1st approach
Let’s assume you can modify the shell script katalonc.sh itself. Then you would want to modify katalonc.sh so that it creates a shell variable $RELEASE_VERSION and updated with the information of which you want to inform your CI/CD pipeline. Then, when katalonc.sh finished, the CI/CD Pipeline (a bash script) can refer to that shell variable.
Here we are concerned about how 2 shell scripts (CI/CD pipeline and katalonc.sh) can communicate.
Here we are not concerned about how the value of RELEASE_VERSION is passed from your Katalon test to the shell script katalonc.sh.
2nd approach
Modify your Katalon Test (Test Listener or Test Case, whatever) to create a file <projectDir>/release_version.txt in which you write any information you want. For example,
releaseVersion = 1.2.3
Then, the CI/CD Pipeline (a bash script) can read and consume the <projectDir>/release_version.txt file soon after katalonc.sh finished. For example, the CI/CD script can do this:
cat $katalonProjectDir/release_version.txt
But, as you are aware, you can not change the katalonc.sh script, because it is the part of KRE itself. So #1 is not your option.