0

I need to use Jacoco, but I need to get context. When I use this command I got this error:

No instrumentation registered! Must run under a registering instrumentation.

Is there a way to use jacoco in InstrumentedTest?

public class ExampleUnitTest {
    @Test
    public void addition_isCorrect() {
        Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
        assertEquals("com.example.jacoco", appContext.getPackageName());
    }
}
Robert
  • 7,394
  • 40
  • 45
  • 64

0 Answers0