katalon-studio-samples / ci-samples

Sample configurations for various CI systems.
Apache License 2.0
54 stars 169 forks source link

Docker Compose Example? #16

Closed kferrone closed 4 years ago

kferrone commented 5 years ago

Hi katalon community and devs!

I have a small contribution. I noticed out of all the ci yaml files, there was no docker-compose, so I made a real nice and easy one. All you need to do is add the docker-compose.yml file to the top level of your project.

docker-compose.yml

version: "3.7"
services:
  katalon:
    image: katalonstudio/katalon:latest
    container_name: katalon
    hostname: katalon
    volumes: 
      - .:/katalon/katalon/source
    entrypoint: katalon-execute.sh
    command: -propertiesFile=/katalon/katalon/source/console.properties

Notice the command only needs a properties file which should already exist at the top level of your project, if not add it and use the code below. Probably best to remove empty variables from the file if they are unused.

console.properties

browserType=Chrome (headless)
retry=0
testSuitePath=Test Suites/TS_RegressionTest
executionProfile=default
deviceId=
kobitonDeviceId=
qTestDestId=
qTestDestType=
remoteWebDriverType=Selenium
remoteWebDriverUrl=

Then you may simply run docker-compose up and voila!

I believe this is the easiest way to run a katalon test through Docker locally, the equivalent docker command is quite large and hard to read.

Here is another way to do the same without the properties file. However it is not as dynamic as using the properties file as you would have to edit the docker-compose.yml file.

docker-compose.yml

version: "3.7"
services:
  katalon:
    image: katalonstudio/katalon:latest
    container_name: katalon
    hostname: katalon
    volumes: 
      - .:/katalon/katalon/source
    entrypoint: katalon-execute.sh
    command: 
      - -browserType="Chrome"
      - -retry=0
      - -statusDelay=15
      - -testSuitePath="Test Suites/TS_RegressionTest"

I would also like to see this as an example in katalon-studio/docker-images Readme file as another use-case. This would be consistent with most docker images readme files because why not have a docker-compose example.

Enjoy!

devalex88 commented 5 years ago

Thank you for this detailed instructions. I'll add this to the README and the sample repository.