GitlabCI: How to specify testSuitePath as a Variable?

Hello friends,

I’m about to setup a gitlab pipeline with katalon, and got everything running fine.
But as I recently moved the testSuitePath into a Variable the exectution failed with following error:

com.kms.katalon.execution.exception.ExecutionException: com.kms.katalon.execution.exception.InvalidConsoleArgumentException: Test suite 'Test' not found.

It is very clear, that the problem is because of the white space in the name of the “Test Suite”-folder, but Katalon Studio does not allow to rename it.

This is my gitlab-ci.yml:

stages:
  - run-katalon-docker-image

run-katalon-docker-image:
  stage: run-katalon-docker-image

  image: docker:23.0.1

  variables:
    DOCKER_TLS_CERTDIR: "/certs"
    CONTAINER_REPOSITORY: "my.repository"
    DOCKERFILE_PATH: "./Docker/"
    DOCKER_IMAGE_NAME: "katalon-runtime"
    DOCKER_IMAGE_NAME_FULL: "$CONTAINER_REPOSITORY/$DOCKER_IMAGE_NAME"
    DOCKER_IMAGE_VERSION: "latest"
    KATALON_VERSION: "8.6.0"
    KATALON_PROJECT_DIR: $CI_PROJECT_DIR
    KATALON_TESTSUITE_PATH: "Test Suites/NameOfTestsuite"
    BROWSER_TYPE: "Firefox" # Chrome, Firefox (headless), Chrome (headless)
    TEST_ENVIRONMENT: "MY-PROFILE"

  services:
    - name: docker:23.0.1-dind

  before_script:
    - docker info

  script:
    # docker build -t $DOCKER_IMAGE_NAME_FULL:$KATALON_VERSION $DOCKERFILE_PATH
    # docker push $DOCKER_IMAGE_NAME_FULL:$KATALON_VERSION
    - docker build -t $DOCKER_IMAGE_NAME:$KATALON_VERSION $DOCKERFILE_PATH --build-arg KRE_VERSION=$KATALON_VERSION
    - docker run -t --rm -v $KATALON_PROJECT_DIR:/tmp/project -v $KATALON_PROJECT_DIR/Reports:/tmp/project/Reports $DOCKER_IMAGE_NAME:$KATALON_VERSION katalonc.sh -projectPath=/tmp/project -apiKey=$KATALON_API_KEY -browserType=$BROWSER_TYPE -retry=0 -statusDelay=15 -executionProfile=$TEST_ENVIRONMENT -testSuitePath=$KATALON_TESTSUITE_PATH

  artifacts:
    expire_in: 1 week
    paths:
      - Reports/
    reports:
      junit:
        - 'Reports/*/NameOfTestsuite/*/JUnit_Report.xml'

In the earlier version of my gitlab-ci.yml I passed the testSuitePath hard coded as part of the docker run command and it worked fine:

docker run -t --rm -v $KATALON_PROJECT_DIR:/tmp/project -v $KATALON_PROJECT_DIR/Reports:/tmp/project/Reports $DOCKER_IMAGE_NAME:$KATALON_VERSION katalonc.sh -projectPath=/tmp/project -apiKey=$KATALON_API_KEY -browserType=$BROWSER_TYPE -retry=0 -statusDelay=15 -executionProfile=$TEST_ENVIRONMENT -testSuitePath="Test Suites/NameOfTestsuite"

And as soon as I move exactly the same string “Test Suites/NameOfTestsuite” into a variable, the Katalon Runtime crashes and has a problem with its own folder naming.
I even tried assigning it to the variable with additional single quotes inside like so

KATALON_TESTSUITE_PATH: "'Test Suites/NameOfTestsuite'"

But it still doesn’t like the whitespace:

com.kms.katalon.execution.exception.ExecutionException: com.kms.katalon.execution.exception.InvalidConsoleArgumentException: Test suite ''Test' not found.

Is there a known solution or at least workaround for this issue?

Thanks,
Simon

You have this:

  script:
    ...
    - docker run -t --rm -v $KATALON_PROJECT_DIR:/tmp/project -v $KATALON_PROJECT_DIR/Reports:/tmp/project/Reports $DOCKER_IMAGE_NAME:$KATALON_VERSION katalonc.sh -projectPath=/tmp/project -apiKey=$KATALON_API_KEY -browserType=$BROWSER_TYPE -retry=0 -statusDelay=15 \
        -executionProfile=$TEST_ENVIRONMENT -testSuitePath=$KATALON_TESTSUITE_PATH

Try changing this to:

        -executionProfile=$TEST_ENVIRONMENT -testSuitePath="$KATALON_TESTSUITE_PATH"

You should enclose $KATALON_TESTSUITE_PATH in a pair of double quotes " ... "

1 Like

Thanks! This looks good.

Directly after posting this (like always haha) I had a similar Idee of leaving the part with the white space inside of the docker command like this:

KATALON_TESTSUITE = "nameOfTestSuite"
...
docker run [...] katalonc.sh [...] -testSuitePath="Test Suites/$KATALON_TESTSUITE"

And this worked.
So you’re absolutely right!

1 Like