mercredi 6 septembre 2017

JUnit Timeout Rule does not work

I am trying to specify a Timeout Rule in JUnit by following this guide. However, it does not work. I made a sample test case containing a delay longer than the timeout, but no timeout occurs while executing the test case.

I have added this @Rule in my test class:

@Rule
public Timeout globalTimeout = Timeout.seconds(10);

I am running Android Studio, and the test case is an instrumented test case.

I think I am using JUnit version 4.12, according to this line in my Gradle file:

compile 'junit:junit:4.12'

What am I missing or doing wrong? Any hints are welcome!

Aucun commentaire:

Enregistrer un commentaire