Run test - operation

Execute another test as part of this test.


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

Run test - Check homepage snippet with its contents expanded
Run test - Check homepage 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.

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
Creating snippets from lines in a test