Table of Contents

Automation Tests

You are here:

To create autamation tests is necessary the Katalon Studio tool. The tests need to be performed in PC and Chrome or Firefox driver is required

Installation

Create Project

  • Select “File>New>Project
Image 1 – Create Project
Image 2 – Project Settings

Create new test

  • Start recording
Image 3 – Demo Start Recording
  • Insert URL e click Record
Image 4 – Demo
  • Perform test
  • Save Script
Image 5 – Save script

Execute Test

To execute a test is required a installed browser (Chrome or Firefox)

Image 6 – Test Execution Options

Testing on server

To run the tests on the server you will need to place the project folder on the server.

The project has the following structure:

  • Data Files (Where test parameters are defined).
  • Object Repository (Where are the objects that the test recorder writes).
  • Profiles (User profiles are used to change setting according to user).
  • Reports (Katalon Studio automatically generates logs with information about the tests).
    • Note: Tos not load the server with unnecessary logs, you can add the following command to the script that runs the tests:
      • rm -rf [path]/SistemaTestes/Reports/202*
  • Script (Where test scripts are stored).
  • Test Cases.
  • Test Suites (Test set).

Command Line

To execute tests on server is necessary to run the following command: ./katalon {options}

Example:

./katalon -noSplash -runMode=console -projectPath=[project path] -retry=1 -retryStrategy=immediately -testSuitePath=”Test Suites/[test name]” -browserType=”Chrome (headless)” -executionProfile=”default” -apiKey=”********-****-****-****-************” –config -proxy.auth.option=NO_PROXY -proxy.system.option=NO_PROXY -proxy.system.applyToDesiredCapabilities=true

  • -runMode=console
    • Run on command line
  • -projectPath
    • Path to the project
  • -retry=1
    • Tests tries after fail
  • -retryStrategy:
    • In case of a test fail, indicates what is the strategy
      • Immediately:
        • After test fail execute immediately same test.
      • allExecutions:
        • Execute all tests.
      • failedExecutions:
        • Execute all tests, then execute failed ones
    • testSuitePath:
      • Path to the test suite
    • browserType:
      • Browser where test will be executed
    • executionProfile
      • Execution profile

You can find other command options in: https://docs.katalon.com/docs/katalon-runtime-engine/command-syntax-command-lineconsole-mode-execution

Sugestion

To simplify the execution of the katalon command we suggest to create a executable file containing the command.

vi [script name].sh

// Add katalon command

./katalon {options}

// To delete generated logs

rm -rf [path]/SistemaTestes/Reports/202*

And compile: chmod +x [script name].sh

To execute:

./[script name].sh

Important Considerations

As Katalon in server is in version 6 it’s important to have in mind some changes.

  • Change window size to 929×879
    • Create file “com.kms.katalon.core.webui.chrome (headless).properties” in folder “[Project Path]/settings/internal/”
    • Insert “{“HEADLESS_DRIVER”:{“args”:[“-window-size\u003d929,879″]}}”
  • Do to browser headless execution being faster sometimes elements are not visible at execution time, so the sugestion is to add the following command:
    • WebUI.delay(1)
  • Do not forget to change fields with data to the current data, use the function to get current date.
  • In case the command WebUI.setText(…) doens’t work, a set of alternative commands can be used:
    • WebUI.sendKeys(findTestObject(…), Keys.chord(Keys.CONTROL,’a’))
    • WebUI.sendKeys(findTestObject(…), Keys.chord(Keys.DELETE))
    • WebUI.sendKeys(findTestObject(…), texto)
Tags: