google / TestParameterInjector

A simple yet powerful parameterized test runner for Java.
Apache License 2.0
393 stars 33 forks source link

Integrate with RobolectricTestRunner #5

Open AlanChiou opened 3 years ago

AlanChiou commented 3 years ago

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?

nymanjens commented 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.

jleskovar-tyro commented 2 months ago

Hi @nymanjens - just wanted to check-in as to whether there was any progress with this? Thanks!

nymanjens commented 2 months ago

I'm on vacation right now, but I'll check when I get back