每一个已注册的根用例:
- The setup method of the suite is called, if it exists
- For each test within the suite:
- The beforeEach method of the suite is called, if it exists
- The test function is called
- The afterEach method of the suite is called, if it exists
- The teardown method of the suite is called, if it exists
So, given the this test module:
define(function (require) {
var registerSuite = require('intern!object');
registerSuite({
setup: function () {
console.log('outer setup');
},
beforeEach: function () {
console.log('outer beforeEach');
},
afterEach: function () {
console.log('outer afterEach');
},
teardown: function () {
console.log('outer teardown');
},
'inner suite': {
setup: function () {
console.log('inner setup');
},
beforeEach: function () {
console.log('inner beforeEach');
},
afterEach: function () {
console.log('inner afterEach');
},
teardown: function () {
console.log('inner teardown');
},
'test A': function () {
console.log('inner test A');
},
'test B': function () {
console.log('inner test B');
}
},
'test C': function () {
console.log('outer test C');
}
});
});
…the resulting console output would be in this order:
outer setup inner setup outer beforeEach inner beforeEach inner test A inner afterEach outer afterEach outer beforeEach inner beforeEach inner test B inner afterEach outer afterEach inner teardown outer beforeEach outer test C outer afterEach outer teardown