Ticket #4242 (closed New Feature: fixed)

Opened 5 years ago

Last modified 5 years ago

Enable running single test

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) (diff)

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' ]

Important Note: The browser's debugging mode should be turned on in order to make this working.

Attachments

4242.patch (2.2 KB) - added by garry.yao 5 years ago.
4242_2.patch (2.3 KB) - added by garry.yao 5 years ago.
4242_3.patch (8.2 KB) - added by garry.yao 5 years ago.

Change History

comment:1 Changed 5 years ago by garry.yao

  • Status changed from new to assigned
  • Owner set to garry.yao
  • Keywords HasTest added

Changed 5 years ago by garry.yao

comment:2 Changed 5 years ago by garry.yao

  • Keywords Review? added

comment:3 Changed 5 years ago by garry.yao

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

Changed 5 years ago by garry.yao

comment:4 Changed 5 years ago by fredck

  • Milestone changed from CKEditor 3.0 to CKEditor 3.1

comment:5 Changed 5 years ago by garry.yao

  • Description modified (diff)

Update with the opinions from Fred.

Changed 5 years ago by garry.yao

comment:6 Changed 5 years ago by garry.yao

Make a new patch and update TC with [4123] and [4124].

comment:7 Changed 5 years ago by garry.yao

  • Keywords Review? removed

Changes committed with [4146].

comment:8 Changed 5 years ago by garry.yao

  • Status changed from assigned to closed
  • Resolution set to fixed

comment:9 Changed 5 years ago by garry.yao

Post-fixed with [4283].

comment:10 Changed 5 years ago by garry.yao

  • Description modified (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy