Get help with testing, discuss unit testing strategies etc.


Post by jflowers45 »

Is there any 'hello world' type example of using getSubTest / launchSubTest?

Post by nickolay »

Its main usage is supposed to be with chain:
        t.chain(
            t.getSubTest(function (t) {

                t.waitFor(1000)

            }),
            { click : 'something' }
        )
There's no "next" function in this case. The idea was that you might want to group certain assertions together, to have collapse/expand on them in the UI.

In general, you can create a subtest instance anytime, and launch it later:
    var test = t.getSubTest('MyTest2', function (t) {
        t.waitFor(500)
    })

    t.launchSubTest(test)
The code above is generally the same as using "subTest" (see docs for example).

However, with "subTest" one need to be careful not to run several subtests simultaneously. No checks are made to prevent that, and several subtests will try to simulate user interactions in the same time, the results won't be stable.

Post by jflowers45 »

This makes sense, and I checked out the SubTest docs as well, thanks!

Post Reply