Skip to main content
brian_thomas2
Adobe Employee
Adobe Employee
Aug 28, 2009 8:48 PM UTC
Answered

Stopping a Test Run

Is there any way of stopping a FU4 test run that is currently in progress?

Thanks,

Brian

This topic is closed to new replies. Start a new post to keep the conversation going.
mlabriolaCorrect answer
Participating Frequently
Aug 28, 2009 8:55 PM UTC

Brian,

Not presently. There is a pleaseStop() method that is intended to provide this support but it proved to be a bit more complicated to wire up due to our green-threading approach.

It is on our hitlist of issues. I will get it in Jira so you can watch it.

Mike

5 replies

Aug 30, 2009 1:14 AM UTC

Here's a way to stop the test run if you're running tests with a a swf application. (based on Flexunit August release).   All of the tests that haven't run yet get marked as ignored.

I'm using this for a demo to try to show how easy it is to use flexunit.

1) StoppableNotifier: extends RunNotifier, but resets the stopped state to false when a test run is started.

This is to allow the test run to be reexecuted, if the user clicks a rerun button in the UI.

2) StoppableCore - a copy of FlexUnitCore, with these differences:

public function stopTestRun():void

{

     (notifier

as RunNotifier).pleaseStop();

}

/**

* Create a new <code>FlexUnitCore</code> to run tests.

*/

public function StoppableCore() {

//notifier = new RunNotifier();

notifier =

new StoppableNotifier();

asyncListenerWatcher =

new AsyncListenerWatcher( notifier, null );

//asyncListenerWatcher.addEventListener( AsyncListenerWatcher.ALL_LISTENERS_READY, handleAllListenersReady, false, 0, true );

}

  

3. A modified BlockFlexUnit4ClassRunner.as with runChild() modified to catch the StoppedByUserException and mark the test as ignored.

//TODO: Deal with async issues here on the notifier finish

// STOP support: if the test run should be stopped, mark the test as ignored.

try

{

     eachNotifier.fireTestStarted();

}

catch

(e:StoppedByUserException) {

     // The test run has stopped - mark the test state as ignored.

     eachNotifier.fireTestIgnored();

     childRunnerToken.sendResult();

     return;

}

4. I have a button click handler wired to call the stopTestRun() method.

5. In the mxml wrapper, an instance of StoppableCore() is used instead of FlexUnitCore.

Translate
Participating Frequently
Aug 30, 2009 1:17 AM UTC

Correct.

That is the basic premise but it does get a little ugly with the async, which is why we haven't released it yet, however, this is a great starting point for anyone that needs the functionality now, so thank you for posting it.

Mike

Translate
brian_thomas2
Adobe Employee
Adobe Employee
Aug 31, 2009 4:33 PM UTC

Thanks! Appreciate all the info!

Is there a bug in JIRA I can keep an eye on?

Translate
mlabriolaCorrect answer
Participating Frequently
Aug 28, 2009 8:55 PM UTC

Brian,

Not presently. There is a pleaseStop() method that is intended to provide this support but it proved to be a bit more complicated to wire up due to our green-threading approach.

It is on our hitlist of issues. I will get it in Jira so you can watch it.

Mike

Translate