Run test - operation

  • on all platforms

This operation executes another test as part of this test.


To perform this operation in the Suitest Test editor use the Run Test line:

Run test - Play all videos snippet with its contents expanded

To perform this operation in the Suitest JavaScript API use the built-in regular JavaScript means:

//reusable-test-steps.js
const suitest = require('suitest-js-api');

//make these steps reusable in other files.
module.exports = async function() {
    await suitest.press(suitest.VRC.OK);
    await suitest.assert.element('My element').exists();
}

// master-test.js:
const suitest = require('suitest-js-api');
const anotherTest = require('./reusable-test-steps');

async function mainTest() {
    await anotherTest(); // reusing the test from another-test.js
    await suitest.press(suitest.VRC.OK);
}

Usage

Run tests helps organize pieces of tests that tend to repeat in multiple places over your test base. It is always a good idea to have the repeating pieces extracted into separate test and then referenced from another test as needed.

Not only does this makes you more flexible with what things to test but also it saves you some future maintenance efforts.

Run test and "Open app" line

It is often convenient to use a test as a snippet as well as a standalone test. To facilitate this Suitest ignores the leading Open app line in a snippet test. However when the snippet test is executed standalone the Open app line is normally executed.

Conditional execution

You can specify your test to execute only if certain assertion passes. Using a conditional Run test you can get rid of a dialog or get the application to some desired state.

Please note however that it is best practice to create your test in as linear a way as possible. Usually the most robust and reliable tests are those cover one specific user journey and are a couple of lines long.

Until / Looping tests

The until option allows you to run a test until a subject matches the specified conditions within a limit.

Please note that the condition is being evaluated before each run (including the first one). Therefore the application has to be already running before the first evaluation.

Run test "looping test" until an element exists but at most 10 times

Repeating test without condition

The exactly option allows you to run a test x amount of times.

Run test 10 times

Creating snippet from existing lines in test editor

Suitest Test editor has a handy function to create a test from selected lines. Simply select the lines you want to organize as a test snippet and press Create snippet from the main tool bar. Selected lines will be automatically replaced with a reference to the created test snippet.

Creating snippets from lines in a test

List of tests where given snippet is used

Inside Suitest Test editor, you are able to see a list of tests that are using given test as a snippet.

List of tests where given test is used as a snippet