Skip to main content

Test Automation User Guide

See how to create scripts efficiently and effectively.

Doris Sooläte avatar
Written by Doris Sooläte
Updated over 2 weeks ago

Introduction

This document is intended to help Scripters understand how best to create scripts.

Scripters should follow all the steps for successful script creation and as a consequence successful automated runs.

  1. Environment setup

    1. in this step, you will configure your environment with all you need.

    2. if you need assistance you can contact the coordinator anytime by opening a ticket

  2. Script development

    1. write the requested scripts using our guidelines

  3. Script validation in Scripter's local machine

    1. validate first your script in your local machine

  4. Sandbox Package Run

    1. you can use our sandbox to validate the scripts, by creating a run and waiting for the results. Depending on the results you can see if the script needs any fixes or it's ready

    2. if no error is verified in the prior step, please send the test package to the coordinator

    3. f you need assistance you can contact the coordinator anytime by opening a ticket

  5. Script validation Testlio

    1. in this step, the coordinator will execute it in PRD

  6. Script acceptance

    1. if no error is detected your script development has been accepted!

If you have any suggestions, related to this document please feel free to give the suggestions to the coordinator anytime.

Have good work!

Guidelines

Please read and understand this provided user guide step by step. Also, notify your coordinator through Google Form if additional libraries other than listed are required. For any blockers please submit a ticket through Google Form.

  • Provided below ‘Comment section at the very top of the code with details:

    /**
    * Scripter's Name:
    * Scripter's Email:
    * Script Creation Date:
    * Additional Libraries Used and Version:
    * Test Case Name:
    * Test Case Description:
    */
  • Add proper comments for a better understanding of logic/implementations in code.

  • Avoid hardcoded data in the script. Declare all variables and respective values at the beginning of your script.

  • If you’re navigating to some views directly, do not hardcode URLs in code, but use constants instead

    • In Java you can use com.testlio.constants.WebAppUrls class for such purposes:

      testpath=suite.xls
      testlibrary=AppObjectsRepository.xls
      reportsType=2
      APKPATH=Simika_School_Management_App_v1.0_21.apk

      … and then you can use it in tests like that:

      ConfiguratorSupport configProps = new ConfiguratorSupport("Environment.properties"); configProps.getProperty("AndroidAppiumURL");

  • Use the ‘Testsuite.xls ’ file to add the project, test cases, test data details explained in the user guide.

  • Use ‘AppRepository.xls ’ file to add object properties details explained in the user guide.

Creating a PR

  • Scripters need to branch out staging branch for creating new test scripts or maintaining existing scripts

  • New branch should be named with test case id, such as Test-43

  • Maximum number of new test scripts, is 2 in a single PR

  • Changes in PR should be linear, i.e. only changes from the staging branch can be merged onto the branch you are working on. Merge from any other branch should be avoided

  • Once, a branch is merged through a PR, into the staging branch, it can not be used further either for new test script creation or maintaining existing scripts

  • Once you are creating PR, please share your excel sheet in the google folder(will be provided soon), naming convention will be discussed soon

  • To Merge conflict for excel sheets, please accept your excel sheet

  • Main is only for production run, once, all tests are working in staging branch, it will merge into main

1. Set Up Your Environment

Make sure you have everything you need.

2. Testlio Platform Execution

Mobile App testing

  • Navigate to Respective workspace in TestLIO Platform Ex: Demo

  • Click Launch new Platform.

  • Go to “Runs” Tab and Create New Run for Automated Test

  • Choose App “Mobile App”

  • Upload “.apk” or “.ipa” file.

  • Select Test Type.

  • Attach the Test Script Package.

  • Attach the custom spec with the below command should be updated with test config file,

For “ANDROID”

- java -javaagent:./dependency-jars/aspectjweaver-1.9.5.jar -jar -Dprovider=testlio -Dmobile.platform=android -Dexecution.type=mobile-native 
-Dtake.screenshots.on.annotated.steps=true -Dallure.results.directory=$DEVICEFARM_LOG_DIR/allure-results -Dappium.screenshots.dir=$DEVICEFARM_SCREENSHOT_PATH *-tests.jar -d $DEVICEFARM_LOG_DIR/test-output -verbose 10

       post_test:
commands:
- cp -n -R ./reports $DEVICEFARM_LOG_DIR
- cp -n -R ./allure-results $DEVICEFARM_LOG_DIR.

For “IOS”

- java -javaagent:./dependency-jars/aspectjweaver-1.9.5.jar -jar -Dprovider=testlio -Dmobile.platform=ios -Dexecution.type=mobile-native -Dtake.screenshots.on.annotated.steps=true -Dallure.results.directory=$DEVICEFARM_LOG_DIR/allure-results -Dappium.screenshots.dir=$DEVICEFARM_SCREENSHOT_PATH *-tests.jar -d $DEVICEFARM_LOG_DIR/test-output -verbose 10

       post_test:
commands:
- cp -n -R ./reports $DEVICEFARM_LOG_DIR
- cp -n -R ./allure-results $DEVICEFARM_LOG_DIR

  • Select Device and Create a new Run Now.

Desktop Web testing

  • Navigate to Respective workspace in TestLIO Platform Ex: Demo

  • Click Launch new Platform.

  • Go to “Runs” Tab and Create New Run for Automated Test.

  • Choose App “Desktop Web”

  • Select Test Type “Selenium Java TestNG”.

  • Attach the Test Script Package.

  • Select Device and Create a new Run Now.

3. Script Development

3. Script Validation Local

4. Sandbox Package run

  1. You can use our sandbox to validate the scripts, by creating a run and waiting for the results. Depending on the results you can see if the script needs any fixes or if it's ready

  2. Without sandbox use ( third party integration) you can submit your packaged script to our QE Manager

  3. If no error is verified in the prior step, please send the test package to the coordinator

  4. If you need assistance you can contact the coordinator anytime by opening a ticket

Please check this next document for more details on how to create automated test runs using Testlio Sandbox.

5. Script Validation (by Testlio team)

Please check this next document “how to understand results” in order to get a clear idea if your script needs any further development or is good enough to send to the coordinator.

6. Script Acceptance

Script quality confirmation!

7. Related instructions

Install Android SDK platform tools using Android Studio

  1. Launch Android Studio

  2. On the Welcome screen click More Actions -> SDK Manager

  3. In the Preferences for New Projects dialog box, navigate to the SDK Tools tab and select set a checkbox on the latest version of Android SDK Platform-Tools (at least)

    Note: It’s recommended to note the location of Android SDK on your computer

  4. Click Apply. Android Studio starts installing the selected packages and tools on your computer. Once installed, the Status of the installed packages and tools changes from Not Installed to Installed.

  5. Click OK.

How to configure Android device emulator

  1. Launch Android Studio

  2. On the Welcome screen click More Actions -> AVD Manager

    More Actions button

    AVD Manager item in the More Actions dropdown

  3. On the Android Virtual Device Manager window click Create Virtual Device

    Create Virtual Device button on the Android Virtual Device Manager window

  4. On the Virtual Device Configuration window choose an Android device model you want to emulate and then click Next

    Virtual Device Configuration - Select Hardware

  5. On the following step select an Android system image you prefer to be installed on the device and click Next.

    Virtual Device Configuration - System Image

    Note: If there is a “Download” link near a release name, it means that this release has not been downloaded yet on your PC, and to use it, you need to download it from the internet by just clicking this link.

  6. On the latest step, we would recommend specifying a custom AVD Name to be able easily to identify the device when using it for testing. Try to avoid using spaces in the name by replacing it with dashes or underscores.

    Virtual Device Configuration - Android Virtual Device (AVD)

    Suggested naming format: {device model}-{platform version}-{api level}

    Example: pixel5-11-30

  7. Before you proceed, note the device name and OS version. You will need these values when you will be launching the tests on this device.

    Device name and OS version

  8. Click Finish when you’re done with a device configuration. The created device will immediately appear in your Android Virtual Device Manager devices list.

    List of created Virtual Devices

  9. Launch the created AVD emulator by clicking on the play button near it

    Launch Virtual Device button

  10. After a while, your device will be configured and ready for testing

    Launched Virtual Device

Launch iOS device simulator from XCode

  1. Launch XCode

  2. From the system top panel navigate to XCode > Open Developer Tool > Simulator

    Simulator item in the XCode top panel menu

  3. Some simulated iOS device should be launching immediately. If not, or you want to launch a simulated device of another model, then from the system top panel navigate to File > Open Simulator > iOS > <device model>

    Simulator options

  4. After the device is loaded, it will be ready for testing

    Launched iPhone simulator

Find Android device identifiers

Real device

  1. On the Android device go to Settings

  2. Tap About phone

  3. Take note of device name and Android version

Emulator

  1. Launch Android Studio

    Android Studio welcome screen

  2. On the Welcome screen click More Actions > AVD Manager

More Actions button

AVD Manager item in the More Actions dropdown

  1. On the Android Virtual Device Manager window find the device you’re going to use and note values from Name and Target columns as shown on the screenshot below:

Device name and OS version

Find iOS device identifiers

  1. Launch XCode

  2. From the system top panel navigate to Window > Devices and Simulators

    Devices and Simulators menu item in XCode

  3. Select device model for which you want to get identifiers for and note values as shown on the screenshot below:

    How to note iOS device identifiers?

    For example, shown on the screenshot values will be:

    • Device OS version: 15.2

    • Device model name: iPhone 11

    • Device identifier: BCA0D9F8-4B11-4D2B-A164-674FC7102D19

Launch the Appium Inspector session

  1. Connect the device to the computer or launch the simulator. You can use one of the following tutorials:

    • How to configure Android device emulator

    • How to launch iOS device simulator from XCode

  2. Launch Appium Server

  3. Launch Appium Inspector

  4. Click on Edit Raw JSON button

  5. Paste one of the following capabilities to the text field and click the Save button:

For Android devices/emulators:

{
"platformName": "Android",
"appium:platformVersion": "<your device os version>",
"appium:deviceName": "<your device name>",
"appium:app": "<local path to apk>",
"appium:automationName": "UiAutomator2",
"appium:autoGrantPermissions": true
}

Note: Don’t forget to put the proper platform version appium:platformVersion and device name appium:deviceName you noted before and path to the apk file appium:app you have downloaded

For iOS devices/simulators:

{     
"platformName": "iOS",
"appium:platformVersion": "<your device os version>",
"appium:deviceName": "<your device name>",
"appium:udid": "<your device identifier>",
"appium:app": "<local path to ipa or app>",
"appium:xcodeOrgId": "<your apple developer account id>"
"appium:xcodeSigningId": "iPhone Developer"
"appium:automationName": "XCUITest”,
}

Note 1: Don’t forget to put the proper platform version appium:platformVersion, device name appium:deviceName and device identifier appium:udid you noted before, the path to the ipa/app file appium:app you have downloaded an Apple Developer account id appium:xcodeOrgId

Note 2: Depending on how you configured WebDriverAgent and on the specific iOS version of your device/simulator, you may need also the following properties:

  • "appium:noReset": true together with "appium:fullReset": false - to not re-install the app on the device (way to avoid “trusting“ Apple developer in settings each time you launch tests)

  • "appium:useNewWDA": false - if you don’t want to reinstall the currently installed version of WebDriverAgent

  • "appium:usePrebuiltWDA": true - to use manually prebuilt using XCode version of WebDriverAgent

6. Click the Start Session button to launch the inspector session

Package tests

In order to run tests on our farm, you need to package them in a compatible format. To do that, you may simply use one the following command, depending on the environment:

Java

mvn package -DskipTests

Node

npm run package

After the packaging process is finished, you will be able to find it in the target directory relative to the project root. The package file should have a name in format {project artifact id}-package-{timestamp}.zip

Did this answer your question?