Reputation: 477
I'm writing some functional tests using Intern/Leadfoot. These tests are end-to-end tests (called also stories) and between them there kind of data dependency. With that I mean that a test (ie. test2) will fail if the previous test (test1) did not complete successfully. So in order to avoid running tests that fail for sure I want to skip them (or part of them). Thus, I wonder if there a way to achieve that.
Consider that all test.js files are like the one below:
define([
"require",
"intern",
"intern!object",
"../../support/executor/executor"],
function(require, intern, registerSuite, Executor) {
var executor;
var steps = [
// set of actions,
// like login, click this button,
// then assert that ....
];
registerSuite(function() {
return {
setup: function() {
executor = new Executor(this.remote, steps.slice(0));
},
"Test 1": function() {
return executor.run();
},
};
});
});
This means that each js file is a suite that contains only one test. In other words, it's like I wanna skip all remaining suites, if a previous one failed.
Upvotes: 3
Views: 1165
Reputation: 6620
The Intern docs specify a this.skip method that is available for unit tests (https://theintern.io/docs.html#Intern/4/docs/docs%2Fwriting_tests.md/skipping-tests-at-runtime) which also works for functional/e2e tests.
"skipped test":function(){
this.skip('skipping this');
}
They also specify a grep-regex option for skipping tests via the config (https://theintern.io/docs.html#Intern/4/docs/docs%2Fwriting_tests.md/skipping-tests-at-runtime).
Upvotes: 6