ahsing / android-test-kit

Automatically exported from code.google.com/p/android-test-kit
0 stars 0 forks source link

Unregister idling resource after each test. #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Here what my test cases looks like:

public class TestPager extends ActivityInstrumentationTestCase2<TestActivity> {

    public void setup() {
         Espresso.registerIdlingResources(new PageIdlingResource());
    }

    public void testA() {
    }

    public void testB() {
    }

}

----

The problem comes from the fact that setup() is called twice during the test 
run: once before testA() and once before testB(). As such, Espresso instanciate 
and keeps the IdlingResource of each test. Let's say I have 20 tests. After 20 
tests I have 20 PageIdlingResource registered. 

So we need a way to unregister any IdlingResource when a test is complete. 
Either automatically, or in the tearDown() method.

Original issue reported on code.google.com by thier...@gmail.com on 7 Dec 2013 at 12:21

GoogleCodeExporter commented 9 years ago
In the next release, Espresso will ignore registration of resources with the 
same name. In the future, we may provide a de-registration method.

Original comment by vale...@google.com on 16 Dec 2013 at 6:17

GoogleCodeExporter commented 9 years ago
Espresso 1.1 will ignore registration requests for duplicate resources.

Original comment by vale...@google.com on 9 Jan 2014 at 7:28