-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use more than one TestParameter
annotation with Android Instrumentation tests.
#9
Comments
Just in case, I tried with https://github.com/square/burst - have the same issue. |
Looks like this library doesn't work well with AndroidJUnitRunner. Can you give an example of how I can reproduce this locally? How do I combine |
Spaces are not supported: android/android-test#956 might be the same issue with commas as that's the separator for listing explicit executions. |
Right, so this could be fixed by filtering spaces and commas from the test name for Android tests. I guess TestParameterInjector could look at the classpath and see if AndroidJUnitRunner is loaded in there. |
Careful, Robolectric might also have it on classpath. |
Hmm, so replacing spaces/commas by underscores is really easy, but I wouldn't want to do this for more use cases than necessary. As a non-expert on Android, can anyone recommend a good way of distinguishing this |
I would recommend checking Espresso source code to see how they detect if the OS is Android. I'm sure okhttp/okio also has one too. |
Just tried this today with a fairly up-to-date Android project and tools, and this seems to work fine now? At least, it was running with my usage with more than one |
When I use only one property with
TestParameter
annotation tests works well.As soon as I add a 2nd property with
TestParameter
annotation then all tests fail.After some investigation I've found that
androidx.test.runner.AndroidJUnitRunner.runnerArgs.tests
contains incorrect list of test classes:my.test.MyTestClass#testCheckSmth[boolParam1=false
boolParam2=false]
And as soon as
TestLoader.doCreateRunner()
tries to create test class instance from stringboolParam2=false]
using reflection it fails later.It is possible that input parameters incorrectly parsed from test args bundle splitting
my.test.MyTestClass#testCheckSmth[boolParam1=false,boolParam2=false]
by coma.Test class sample:
When I use the same sample with standard JUnit tests it works well.
Test output:
The text was updated successfully, but these errors were encountered: