If registered in the suite, this will be carried out upon the suite (the collection of tests
ending. You can also add individual teardowns within tests, that will execute when the individual
test has ended. In this example here, within the test, we create an applciation, and after the
test, we wish to remove that application:
example
module.exports= { title: 'Example', tests: [ { title: 'Move device to another application',run: asyncfunction(test) {// create an appawaitthis.context.get().balena.sdk.models.application.create({ name: APP, deviceType: DEVICE_TYPE, organization: ORG, });// Register a teardown that will remove the test when the test endsthis.teardown.register(() => {returnthis.context.get().balena.sdk.models.application.remove(APP); });// THE REST OF THE TEST CODE } } ] }
TaskQueue
A queue of tasks to be carried out at a certain part of the suite or test.
Teardown
A TaskQueue used to maintain a list of tasks to execute at the end of the suite or test. These will execute regardless of passing or failing.
If registered in the suite, this will be carried out upon the suite (the collection of tests ending. You can also add individual teardowns within tests, that will execute when the individual test has ended. In this example here, within the test, we create an applciation, and after the test, we wish to remove that application: