Is this expected behaviour for SMTRunnerEventsListener?

Answered

I have my own

SMTRunnerEventsListener

and I am overriding the onTestFinished() method. What I observed is that if I block the onTestFinished() method (I do not return for a while), then the next unit test is not started. This is expected behavior and I need this functionality for my plugin. But I have observed that this does not work for the second test for some reason(when I run a test class which contains many methods annotated with @Test). I am using JUnit 5.

So if I have 

@Override
public void onTestFinished(@NotNull SMTestProxy smTestProxy) {
try {
Thread.sleep(9000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}

The second test is started even before the sleep is over(third unit test is not started). Is this a bug or expected behavior?

2 comments
Comment actions Permalink

Hi,

It's unexpected though if your first test fails then `testFinished` may be omitted and this means that listener won't be called at all.

https://confluence.jetbrains.com/display/TCD10/Build+Script+Interaction+with+TeamCity

Could you please check this scenario? BTW if you enable logging for 

com.intellij.execution.testframework.sm.runner

then you may get more info on the events, etc

Anna

0
Comment actions Permalink

Hey Anna, 
Thanks for the quick reply. I have 3 tests and none of them fails. The

onTestFinished

is called three times but not timed correctly(as previously said).

I will debug IntelliJ's code to see where the issue is.

0

Please sign in to leave a comment.