Skip to content
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

fix: Modify test names inside PatrolJUnitRunner to remove spaces #2361

Merged
merged 3 commits into from
Oct 8, 2024

Conversation

piotruela
Copy link
Collaborator

@piotruela piotruela commented Oct 8, 2024

Replaces spaces in the name returned by listDartTest with a version that does not contain spaces.
The change is also visible in the report, as it reflects the names of the tests (functions) that are executed as tests.

This PR is in fact slightly modified #2360 created by tddang-linagora so kudos to him for the initial work.

Copy link

docs-page bot commented Oct 8, 2024

To view this pull requests documentation preview, visit the following URL:

docs.page/leancodepl/patrol~2361

Documentation is deployed and generated using docs.page.

@github-actions github-actions bot added the package: patrol Related to the patrol package (native automation, test bundling) label Oct 8, 2024
Copy link
Collaborator

@pdenert pdenert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but you have to add changelog, bump package version and update compatibility table

Copy link
Collaborator

@pdenert pdenert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@piotruela piotruela merged commit 7d30e0a into master Oct 8, 2024
14 of 16 checks passed
@piotruela piotruela deleted the fix/test-name-separator branch October 8, 2024 13:33
@Wreos
Copy link

Wreos commented Oct 10, 2024

Should I update "androidx.test:orchestrator version as well? Currently I have 1.4.2 (as in documentation) ?

Because after updating to Patrol 3.11.1 I have another problem when run tests in firebase
java.lang.RuntimeException: Could not open stream for output FATAL EXCEPTION: AndroidTestOrchestrator Process: androidx.test.orchestrator, PID: 8626 java.lang.RuntimeException: Could not open stream for output at androidx.test.orchestrator.AndroidTestOrchestrator.getOutputStream(AndroidTestOrchestrator.java:5) at androidx.test.orchestrator.AndroidTestOrchestrator.executeNextTest(AndroidTestOrchestrator.java:11) at androidx.test.orchestrator.AndroidTestOrchestrator.runFinished(AndroidTestOrchestrator.java:10) at androidx.test.orchestrator.TestRunnable.run(TestRunnable.java:11) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012)

@piotruela
Copy link
Collaborator Author

Hi @Wreos. I suspect you've encountered this issue. Patrol 3.11.1 modifies the test name to comply with the requirements of the new orchestrator version which is used on Firebase Test Lab. Probably after the modification, your test name is not a bit too long. Yes, you can try bumping androidx.test:orchestrator version to 1.5.0 in your project. Alternatively you can try modifying test names to be shorter.
Let me know it helps.

@tddang-linagora
Copy link

Hi @Wreos

The androidx.test:orchestrator dependency only matters in your own local test environment. Firebase Test Lab ignores that and always runs with the latest version.

Because after updating to Patrol 3.11.1 I have another problem when run tests in firebase

If your project is able to run on Flutter 3.24.x, you can upgrade Patrol and its CLI to the latest version to resolve your issue. Our team's project is stuck with 3.22.x, so we reverted our Patrol dependency version to 3.11.0 and that fixed our Firebase test crash too.

Hope this helps you.

@Wreos
Copy link

Wreos commented Dec 9, 2024

Hi @Wreos

The androidx.test:orchestrator dependency only matters in your own local test environment. Firebase Test Lab ignores that and always runs with the latest version.

Because after updating to Patrol 3.11.1 I have another problem when run tests in firebase

If your project is able to run on Flutter 3.24.x, you can upgrade Patrol and its CLI to the latest version to resolve your issue. Our team's project is stuck with 3.22.x, so we reverted our Patrol dependency version to 3.11.0 and that fixed our Firebase test crash too.

Hope this helps you.

Big thanks for your feedback, for now everything works fine for me with latest version Patrol and Flutter 😄
But in the past, to make everything work after this change I had to shorten the test names and change the spaces to _ to work with patrol > 3.11.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: patrol Related to the patrol package (native automation, test bundling)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants