Opened 15 years ago

Last modified 15 years ago

#4242 closed New Feature

Enable running single test — at Version 5

Reported by: Garry Yao Owned by: Garry Yao
Priority: Normal Milestone: CKEditor 3.1
Component: QA Version:
Keywords: Confirmed HasTest Cc:

Description (last modified by Garry Yao)

In unit testing, previously we've been used the following trick a lot to achieve:

  1. Force executing only one specific test:
  2. 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' ]

Change History (8)

comment:1 Changed 15 years ago by Garry Yao

Keywords: HasTest added
Owner: set to Garry Yao
Status: newassigned

Changed 15 years ago by Garry Yao

Attachment: 4242.patch added

comment:2 Changed 15 years ago by Garry Yao

Keywords: Review? added

comment:3 Changed 15 years ago by Garry Yao

Fix a minor bug in the previous patch that one affiliate function - YAHOO.tool.TestCase.Wait was lost.

Changed 15 years ago by Garry Yao

Attachment: 4242_2.patch added

comment:4 Changed 15 years ago by Frederico Caldeira Knabben

Milestone: CKEditor 3.0CKEditor 3.1

comment:5 Changed 15 years ago by Garry Yao

Description: modified (diff)

Update with the opinions from Fred.

Changed 15 years ago by Garry Yao

Attachment: 4242_3.patch added
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy