vendredi 20 mai 2016

JUnit test for an expected timeout

I have a test of communication over a TCP socket where I expect the server to not respond within a set time frame when I send a certain message.

The servers behaviour is nothing I can control.

I know hot to fail a test if it has not completed within a set time frame. But how can I do the opposite, make it pass for not completing within the timeframe?

I can use @Test (timeout=1000) to make a test fail if not complete within a second.

But, using Junit 4, is there a function to test for an expected timeout as a positive result? I.e. The test will fail if completed within the time frame and pass if not?

Aucun commentaire:

Enregistrer un commentaire