Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Can't run Parameterized tests #133

Open
TarCV opened this issue Feb 24, 2018 · 1 comment
Open

Can't run Parameterized tests #133

TarCV opened this issue Feb 24, 2018 · 1 comment

Comments

@TarCV
Copy link

TarCV commented Feb 24, 2018

Hello,

In a company I work at, we tried to use JUnit Parameterized tests and found that Fork can't run them properly. There are two issues with it:

  • There are tests left unprocessed error for all Parameterized test classes (both without custom names and with custom names)
  • Parameterized tests with custom names are not executed

(Ping me if you think that I should fill two separate issues)

I created a project to demonstrate these problems - https://github.com/TarCV/ForkBugDemo

  • com.github.tarcv.forkbugdemo.ParameterizedTest - a parameterized test without any custom name
  • com.github.tarcv.forkbugdemo.ParameterizedNamedTest - a parameterized test with a custom name

Execution log:

$ ./gradlew fork
Starting a Gradle Daemon, 10 stopped Daemons could not be reused, use --status for details
00.05 00% 0 Android SDK built for x86 [emulator-5554] .NormalTest#test
00.07 33% 0 Android SDK built for x86 [emulator-5554] .ParameterizedTest#test[0]
00.08 66% 0 Android SDK built for x86 [emulator-5554] .ParameterizedTest#test[1]
00.08 100% 0 Android SDK built for x86 [emulator-5554] .ParameterizedTest#test[2]

> Task :app:forkDebugAndroidTest
done
There are tests left unprocessed: [com.github.tarcv.forkbugdemo.ParameterizedNamedTest#test on Unknown device, com.github.tarcv.forkbugdemo.ParameterizedTest#test on Unknown device]
There are tests left unprocessed: [com.github.tarcv.forkbugdemo.ParameterizedNamedTest#test on Unknown device, com.github.tarcv.forkbugdemo.ParameterizedTest#test on Unknown device]

Thanks

@TarCV
Copy link
Author

TarCV commented Feb 27, 2018

Proposed fix for ParameterizedTest

Unfortunately ParameterizedNamedTest is harder. The issue with it is that am instrument -w -r -e class com.github.tarcv.forkbugdemo.ParameterizedNamedTest#test com.github.tarcv.forkbugdemo.test/android.support.test.runner.AndroidJUnitRunner command will not run it. You either need to specify a child test name (like #test[param = 3]) or not specify method name at all.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant