Posted on

Videotutorial 09: Variables and Data

This is the nineth tutorial of this series explaining how to use variables and data in testup.io. So if you want to learn how to use variables and data in your test, testup.io is is ready for you:

  • Using the clipboard
  • Seting runtime variables
  • Working with test variables

Also read our post about how to integrate tests into Gitlab CI/CD pipelines

You’ll find more information about useful PHP commands in the using the editor advances section of our documentation. 

Posted on Leave a comment

CI-CD Results API

This page lists the API calls that are meant for external integration. Currently there is one endpoint to get information in JSON format.

Also look at Integrate testup into the CICD pipeline, for API calls to start schedules and get response in plain

Authentication

All calls to our api can be authorized via the ApiKey. You can get this key from your user, or your project settings page. Please check for a description on to get this ApiKey in step one of cicd integration. For following we assume that $TESTUP_APIKEY is set to your key.

To access any REST endpoints you need to set the following header

Authentication: ApiKey-v1 $TESTUP_APIKEY

In curl commands you can set the Header like this:

curl … -H “Authentication: ApiKey-v1 $TESTUP_APIKEY”

Project status

The project status call returns the result of the previous test runs. You can call the following address to the get the current status

https://app.testup.io/cicd/project/$PROJECT_ID/results

The following query parameters are possible:

limit Number of past executions that are included in the response (default 20)
fromDate start time of the execution list (Iso format: YYYY-mm-DDTHH:MM:SS)
toDate end time of the execution list (Iso format: YYYY-mm-DDTHH:MM:SS)

Example:

curl “https://app.testup.io/cicd/project/$PROJECT_ID/results?limit=1” -H “Authorization: ApiKey-v1 $TESTUP_APIKEY”

Response:

{
  "project": {
    "id": 1,
    "name": "Project name"
  },
  "executions": [
    {
      "id": 2,
      "name": "Run by Schedule",
      "startTime": "2023-10-18T16:15:00.239571Z",
      "tests": [
        {
          "id": 3,
          "name": "Test case one",
          "status": "PASSED",
          "failedRecordings": []
        },
        {
          "id": 4,
          "name": "Test case two",
          "status": "PASSED",
          "failedRecordings": []
        }
      ]
    }
  ]
}
Posted on Leave a comment

How to use Find with multiple anchor areas

In case there are multiple possible anchor areas in the system under test and you need to check if at least one of them can be found on the device screen, you can use .

This function searches for every possible anchor area and saves the result in a runtime variable with . In the end, you can either throw or not throw an error, depending on the value of the runtime variable.

Insert multi-check into a test.

Make sure you are in mode.

  1. Use to search for the first anchor area.
  2. Click .
  3. Enter the following PHP command to save the result of the find to a runtime variable:
  4. EVAL set("some_var_name")
  5. Use to search for the second anchor area.
  6. Enter the following PHP command to save the combined result of this and all previous finds to the runtime variable:
  7. EVAL set("some_var_name", $CLIPBOARD=="True" || get("some_var_name")=="True")
  8. Repeat step 4 and 5 for every possible anchor area.
  9. Enter the following PHP command to throw an error if none of the previous finds was successful:
  10. EVAL get("some_var_name") || error("a custom error message") 

Posted on

Cheat Sheet

[Test Setting Page] [Keys] [EVAL] [Jumps] [Loops] [max.Runtime] [Sub-Return] [Various Images]

Advanced Commands Test Setting Page

Quality2Threshold number (try between 30 and 40)
ExperimentalContinuationLimitnumber
isPersistenttrue
ScreenshottingModedevice-screen”  (high resolution screenshot (‘experimental’ style))
browser-window” (old ‘non experimental’ style)

Keys

CTRL + →rotate clockwise
CTRL + ←rotate counter clockwise
CTRL + Rrefresh

EVAL Statements

Sendkeys

EVALsendkeys("any text",100)

Parse German Number Format

EVALstr_replace(",", ".", str_replace(".","", $CLIPBOARD))

Checks with Custom Error Messages

FINDimage
EVAL$FLAG || error('specific failure description')

Jumps

Normal Jump

JUMP(T/F)any name

… some more actions …

TAG#any name

Jump based on clipboard value

JUMPscr($CLIPBOARD)

Loops

Simple Loop

TAG#any name

… some more actions …

JUMP (T/F)any name

Maximum Loop Passes
(Option 1 – longer but better readable)

TAG#start
EVALset("counter", get("counter")+1) < 10
JUMP (F)#out
FINDsomething
JUMP (T)#start
TAG#out

Maximum Loop Passes
(Option 2 - shorter with && operation)

TAG#start

... clicking or something ...

FINDsomething
EVALset("counter", get("counter")+1) < 3 && $FLAG
JUMP (T)#start

Limit the Time that a Loop Runs

EVALtime() - set("time", get("time") || time()) < 10 && ....

Maximum Runtime for Blocks

EVALset("time", time())
TAG#start

... some actions ...

EVALtime() - get("time") > 100 && error("More than 100 seconds passed. Stopping")
JUMP#start

Sub - Return

With JUMP sub:test you set the base of the following jump session
The command makes you jump to the TAG #sub:test
With the Jump #return:test you jump back to the place where you started (set the baseline)

JUMPsub:any name

... some more actions ...

TAG#sub:any name

... some more actions ...

JUMPreturn:any name

Combined Image Search

You have different images that show up randomly. That's how you can check if one of them is appearing.

FINDimage1
EVALset("result", $FLAG)
FINDimage2
EVALset("result, $FLAG || $result)
FINDimage3
EVALset("result, $FLAG && $result) 
Posted on Leave a comment

How to use OCR

In case it’s not possible to select or copy a text, use button in mode. Optical Character Recognition will extract all characters that are selected and copy them into a Clipboard content.

Make sure the Editor is in mode.

  1. Select a stable anchor area.
  2. Draw a swipe over coded or changing content. Editor automatically switches to mode.
  3. Click on to change swipe action into OCR action. The recognized area, marked in green rectangular, is copied to Clipboard content. 
  4. Click Play it to confirm and record the action.