Open AlanChiou opened 3 years ago
Is possible that using TestParameterInjector as a Rule?
AFAIK, that's not possible in JUnit4, unfortunately. The only solution I think is to make a test runner that combines RobolectricTestRunner
and TestParameterInjector
or modify RobolectricTestRunner
to support TestParameterInjector
annotations.
We have an internal feature request to do this second option (RobolectricTestRunner
to support the TestParameterInjector
annotations). However, I'm being told this might either be a lot of work or practically impossible. I'll update this thread if we make any progress here.
Hi @nymanjens - just wanted to check-in as to whether there was any progress with this? Thanks!
I'm on vacation right now, but I'll check when I get back
If we test an Android component(Activity, Fragment, Service...) with Robolectric, we will use
RobolectricTestRunner
as the test runner.And a test class only have a test runner. I also find a way to run a test class within multiple test runners, but I have no idea if it works with TestParameterInjector. https://bekce.github.io/junit-multiple-runwith-dependent-tests/
Could you have a look about this topic? Is possible that using TestParameterInjector as a Rule?