diff --git a/plugins/junit/src/com/intellij/execution/junit2/ui/actions/RunningTestTracker.java b/plugins/junit/src/com/intellij/execution/junit2/ui/actions/RunningTestTracker.java index 5c4e5f6ce0cf..01c553f32d03 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/ui/actions/RunningTestTracker.java +++ b/plugins/junit/src/com/intellij/execution/junit2/ui/actions/RunningTestTracker.java @@ -60,13 +60,18 @@ class RunningTestTracker extends JUnitAdapter implements TestFrameworkPropertyLi public void onTestChanged(final TestEvent event) { if (event instanceof StateChangedEvent) { final TestProxy proxy = event.getSource(); - if (proxy == myLastRan && !isRunningState(proxy)) { - if (myLastSelected == proxy){ + final boolean isRunning = isRunningState(proxy); + if (isRunning) { + if (proxy.isLeaf()) { + myLastRan = proxy; + } + if (myLastSelected == proxy) { myLastSelected = null; } + } + else if (proxy == myLastRan) { myLastRan = null; } - if (proxy.isLeaf() && isRunningState(proxy)) myLastRan = proxy; myTrackingPolicy.applyTo(proxy); } }