mziemer
mziemer

Reputation: 348

TestNG Android Unit Tests, Stub! Exception

I am getting "java.lang.RuntimeException: Stub!" and it is because android.jar contains only stub implementation of the classes. I will not be running the tests in an emulator. Robolectric works with JUnit but it does not appear to work with TestNG. Is it possible to run TestNG classes without an android emulator? All I need is a Context and I would like to use MockContext but every method is a Stub! exception.

Upvotes: 2

Views: 597

Answers (1)

Alex Florescu
Alex Florescu

Reputation: 5151

No, it doesn't work out of the box.

The problem is that you need a test runner. If this was a JUnit test, you would use @RunWith(RobolectricTestRunner.class), but with TestNG, you can't easily do that.

Upvotes: 2

Related Questions