What is a test?
A test is simply a reusable sequence of actions that you can customize and even modify each time you run it. For example, you might create a test with an API call and use a different URL each time you run it (e.g., beta.my-api.com or prod.my-api.com). Or, you could set up a test to call a phone number and change the number if needed. Let’s dive in and see how it works!
Creating a test from the remote control history
An easy way to create a test is simply to take actions from the remote control history and use these actions to build a test. To access the history, simply swap to the "History" tab on the "Live Session" page:
This page shows all the commands you’ve previously sent to your devices. You can filter them by device using the "Resource" filter or by the user who ran the command using the "Creator" filter:
To create a new test from the history, simply click Add to append any past command to the new test:
Each added command will be added along with its configuration (e.g. for an API call, the URL of the API, for a USSD action, the code that was sent, etc), so you'll not have anything more to do before saving your test.
When you are done, just click Create test:
You will be directed to the test creation page, and the test will be ready for you to save. You will only need to enter a name for it, all the actions previously selected will be present:
Running tests
Now, let's save the test and run it! Saving the test redirects you to the tests page. Then, click the Add button next to its name, and the test will be added to the Run list in the right pane.
You can add as many tests as you want to the run list, different tests or the same test several time by reclicking the Add button. Alternatively, there is another way of repeating a test several times. Just click on the x1 (or x2, x3, etc... depending on the number of repetitions) next to the test in the run list:
When you're done, click the Run button at the top of the list. You will be taken to the run confirmation page.
The purpose of this page is to let you customize the tests one last time before running them. In the area titled Your tests, you can override the variables. All the public variables will appear here, and all owners will appear in the Owners column. For instance, if you have a 3-step test and your steps 1 and 3 use the same owner kapptimobile-ethernet-1, you can change that owner (and decide, for instance, to use my-ethernet-2 instead). However, you cannot separately override the owner of each single step.
The Platform selector at the very top is only needed for advanced usage and thus will not be explained in this tutorial. Leave it untouched, unless you know what you're doing. It may not even appear if you only have one platform.
The Name field just below lets you give a name to the tests results. If you don't specify one, the results will take a generic name.
When you are ready, click Run. You will be redirected to the results page.
Viewing tests results
This is what you may see on the results page:
Since a resource (owner) may be used by any number of tests but never at the same time, a test will not start as long as at least one of its resources is busy (used by another test that is still running). If such is the case, then our test will remain in Pending state until the resource is freed:
When the test starts running, its states becomes Ongoing. After it is finished, its state will be either Success or Failed.
Now, we want to see the details of what happened. Click on the results and you'll see the details page:
Since the API's response is taking a big part of the screen, you may want to hide it. You can click the API response summary bar to collapse it:
After the API response, you can see that the assertion "Check that status code is equal to 200" succeeded:
That's it! In the last part, we will see how to schedule your test to run at regular intervals and how to collect metrics. Let's head to the monitoring basics part ▶