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

Invalid test names for repeated and parametrized tests #317

Closed
olga999999 opened this issue Mar 25, 2024 · 8 comments
Closed

Invalid test names for repeated and parametrized tests #317

olga999999 opened this issue Mar 25, 2024 · 8 comments
Assignees
Labels

Comments

@olga999999
Copy link

Information about the test's parameter and repetition is not included in the test name when tests are executed not as a whole test class/suite, but separately, one by one. This leads to the automatically generated logcat logs having the same filename and therefore being overwritten on each repetition/parameter.
E.g. on the screenshot below the whole test suite is executed. Test names contain the information about repetitions and parameters.
image
Here only one test is executed at a time. No information about repetitions and parameters.
image
image

@mannodermaus
Copy link
Owner

Hey, thanks for reporting. I can't confirm that this is what I see on my end, the output is identical whether I execute the entire instrumentation test suite or a single class. 🤔

Single Suite
single suite

May I ask what version of JUnit 5, the android-junit5 plugin and its instrumentation libraries you are using in your project? It's possible that a recent unreleased change has improved something that hasn't been publicized yet.

@olga999999
Copy link
Author

olga999999 commented Apr 9, 2024

Hey, thanks for reporting. I can't confirm that this is what I see on my end, the output is identical whether I execute the entire instrumentation test suite or a single class. 🤔

Sorry for my bad explanation. If you execute a whole class, the issue won't appear. Can you try executing only repeatedTestExample or only parametrizedTestExample?

@mannodermaus
Copy link
Owner

Thank you for the quick response and explanation! No worries, I was the one who read it wrong – "only one test" was referring to a single test method, not a single test class. With this cleared up, I can reproduce this on my end as well:

Screenshot 2024-04-10 at 9 16 24

Having identical test names could create other problems down the line, so this is definitely something that needs fixing. Thanks for reporting!

@mannodermaus mannodermaus self-assigned this Apr 10, 2024
@mannodermaus
Copy link
Owner

mannodermaus commented Apr 10, 2024

Good news! I narrowed down the cause for this to some special case handling inside the test tree generator. Unfortunately, I cannot simply remove this safeguard, as it would break other single-method executions from the IDE (such as #199 and #207, which were the original motivation for adding this). The reason is a limitation in how the Android instrumentation expects its classic tests to be named. This restriction doesn't seem to apply to all kinds of tests though, so I may have an approach in the works. Stay tuned for more.

Edit: We've got it. 💪

Screenshot 2024-04-10 at 20 25 11

@mannodermaus
Copy link
Owner

This will be released alongside the upcoming instrumentation test libraries 1.5.0! If you need the fix now, you can use the 1.5.0-SNAPSHOT in the meantime. 🙇‍♂️

@olga999999
Copy link
Author

This will be released alongside the upcoming instrumentation test libraries 1.5.0! If you need the fix now, you can use the 1.5.0-SNAPSHOT in the meantime.

Thank you so much!

@olga999999
Copy link
Author

Sorry for bothering you again, but it looks like SNAPSHOT version is not available on maven.

@mannodermaus
Copy link
Owner

mannodermaus commented Apr 11, 2024

Not on Maven Central anyway, that's correct. You'd need to grab them from their snapshots repository by adding the following repository to your project:

repositories {
  // mavenCentral(), google(), whichever other repositories you have, are here already...
  // Then please add this one
  maven { setUrl("https://oss.sonatype.org/content/repositories/snapshots/") }
}

Sorry, I usually add this to my comments when resolving tickets, but forgot this time. 🙈

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

No branches or pull requests

2 participants