Skip to main content
brian_thomas2
Adobe Employee
Adobe Employee
August 28, 2009
Answered

Stopping a Test Run

  • August 28, 2009
  • 2 replies
  • 2464 views

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

Thanks,

Brian

This topic has been closed for replies.
Correct answer mlabriola

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

2 replies

August 30, 2009

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.

Participating Frequently
August 30, 2009

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

brian_thomas2
Adobe Employee
Adobe Employee
August 31, 2009

Thanks! Appreciate all the info!

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

mlabriolaCorrect answer
Participating Frequently
August 28, 2009

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