In unit testing, previously we've been used the following trick a lot to achieve:
- Force executing only one specific test:
- Running the test without the evolving of YUI runner, which means instead of having exceptions been caught by the runner, they were throwing to browser's default exception handling logic, which is more friendly for debugging.
// Run one specific test without registering to YUI runner.
window.onload = testCase.testName;
Now when adapting to our new testing system CKTester( #4218 ), the old approach doesn't work at all, so this ticket
is intended to figure out a better way for achieving the above two goals without change CKTester.
One official way ( from YUI Test functionality ) is to use this kind of 'meta instructions' on a test case:
var oTestCase = new YAHOO.tool.TestCase({
_should: {
ignore: {
testName: true //ignore this test
}
}
});
We should be easily extend it with certain new instructions to support our above desired functionality:
_should: {
ignoreAllBut: {
testName: true // Ignore all tests except this, comment this line to toggle it.
},
throws: {
testName: true // This test should throws exception instead of having it caught by runner.
}
}
With a little bit simplification, it could be written in the following form, which should be more easier to understand and modify.
shouldIgnoreAllBut : [ 'testName' ],
shouldThrows : [ 'testName' ]
Important Note: The browser's debugging mode should be turned on in order to make this working.
Ticket test added with [4105] at : source:CKEditor/trunk/_test/tt/4242/4242.html