android-test
android-test copied to clipboard
Orchestrator crashes on function names with whitespaces
Description
Using whitespaces in test function names lead to an orchestrator crash.
Steps to Reproduce
Create a new Android Studio project, add the orchestrator, create a test function containing whitespaces like
fun `my test function`() {
...
}
and run it with ./gradlew :app:connectedDebugAndroidTest
Expected Results
The test passes.
Actual Results
The orchestrator crashes with
androidx.test.orchestrator E FATAL EXCEPTION: AndroidTestOrchestrator
Process: androidx.test.orchestrator, PID: 8446
java.lang.IllegalStateException: Params must not contain any white-space to avoid encoding issues.
at androidx.test.orchestrator.TestRunnable.buildShellParams(TestRunnable.java:234)
at androidx.test.orchestrator.TestRunnable.run(TestRunnable.java:136)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)
AndroidX Test and Android OS Versions
Orchestrator 1.5.0 (Android 14)
(older versions work)
I assume it was introduced with that commit: https://github.com/android/android-test/commit/8383d784e51dd67972f79f7738e19e7e99706d23
Link to a public git repo demonstrating the problem:
This might seem a minor problem when caused by spaces in your function name, where you might for the sake of a workaround replace the function name. But if the test name is generated dynamically by junits Parameterized runner, based on parameters that contain spaces, it becomes a more serious nuisance.
We reproduced mentioned error with "androidx.test:orchestrator:1.4.2", running our Flutter app instrumented tests (Patrol framework) in Firebase Test Lab on real Android device with API 34.
We reproduced mentioned error with "androidx.test:orchestrator:1.4.2", running our Flutter app instrumented tests (Patrol framework) in Firebase Test Lab on real Android device with API 34.
Our app also produce this problem with the same circumstances.
- compileSdkVersion 34
- Using Firebase Test Lab
- androidx.test:orchestrator:1.4.2
- Not using Patrol
Hello! i faced with this issue too :( any solutions?
We faced this problem in our project as well. If you have a solution, I would like to know.
Any updates on this? I'm facing this every time I need to run a test on Firebase Test Lab now and I don't use Patrol or any other lib other than the regular Espresso and Orchestrator libs.
Also, my test function names don't have spaces between them, they're like testSomething() instead. So it's definitely something internally with the Orchestrator lib when attempting to launch things 😞
Tried on Android 14 and Android 12 also and it has the same effect/error.
For patrol users, fix is merged, see https://github.com/leancodepl/patrol/pull/2361 and this comment: https://github.com/leancodepl/patrol/pull/2360#issuecomment-2399899318
This was merged in patrol, any chances of getting a new orchestrator lib from Android version with a similar fix? I'm not using flutter.
This was merged in patrol, any chances of getting a new orchestrator lib from Android version with a similar fix? I'm not using flutter.
This is how I figured out the fix.
- Clone https://github.com/android/android-test, read https://github.com/android/android-test/blob/main/CONTRIBUTING.md on how to build the project
- Write some log in
buildShellParamsofTestRunnable.java, see if any params look familiar to your project. If one of them contain space character, it's the culprit. There's a high chanceEspressois wronging you. - If so, dive into
Espressorepo to see where they are naming things, and maybe open a PR for them, or just fork that and use your custom version.
@dennismozart1994 Hope this help you.
The reports of this occurring on androidx.test.orchestrator:1.4.2 confused me. According to my (limited) testing this does indeed seem to be a regression introduced by https://github.com/android/android-test/commit/8383d784e51dd67972f79f7738e19e7e99706d23
The reports of this occurring on androidx.test.orchestrator:1.4.2 confused me.
Firebase Test Lab ignore androidx.test:orchestrator version in app:build.gradle and run with the latest version. So which version of androidx.test:orchestrator is set doesn't matter.
I've reached Firebase Support team about this issue by e-mail, and they were quicker than I expected to answer us. After a few back & forth with e-mails & investigations on their end, it looks like that they've rolled back the version of orchestrator upgraded on Test Lab due to this regression and that they will report it back to the owner of Orchestrator to fix this issue before they consider upgrading this lib on their end again. My tests are now working again just fine with no changes required. So, it looks like it was an issue with Firebase Test Lab in the end for my scenario at least.
I'd suggest any of y'all to try and re-run on Firebase Test Lab the tests again, it's working just fine for me now after this rollback since yesterday.
Yep I'm in communication with the Firebase Test Lab folks.
androidx.test:orchestrator:1.5.1 is out now with a revert for this issue. Please let me know if you all continue to see issues.