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

Expose discovered specs as TestDescriptors during discovery and add support for unique IDs #3461

Merged
merged 7 commits into from
Apr 4, 2023

Conversation

marcphilipp
Copy link
Contributor

This PR makes Kotest compatible with the requirements that are documented in the JUnit User Guide for interoperability with build tools and IDEs.

In particular the following two properties were not met prior to this change:

  • Unless to indicate an empty discovery result, the TestDescriptor returned from TestEngine.discover() should have children rather than being completely dynamic. This allows tools to display the structure of the tests and to select a subset of tests to execute.
  • A TestEngine must be able to discover UniqueIdSelectors
    for any unique ID that it previously generated and returned from TestEngine.discover(). This enables selecting a subset of tests to execute or rerun.

For Gradle Enterprise, we are relying on these properties in order to select a subset of the TestPlan for Predictive Test Selection and in order to split it into subsets that can be distributed with Test Distribution. Therefore, our customers could not use neither of these features when using Kotest. However, we’re convinced other tools will also benefit from Kotest being more inline with other TestEngine implementations such as JUnit Jupiter or Spock to provide a consistent user experience for their users.

marcphilipp and others added 2 commits March 23, 2023 08:45
Rather than storing the discovered spec classes in
KotestEngineDescriptor it now uses exposes them as child
TestDescriptors so that tools and IDEs can inspect the test plan prior
to executing it.

Co-authored-by: Jérôme Prinet <jprinet@gradle.com>
Based on a previously discovered `TestPlan`, tools may decide to split
it and use `UniqueIdSelectors` to create multiple smaller `TestPlans`.
Another use case is rerunning a test class, for example, because it
failed.

Co-authored-by: Jérôme Prinet <jprinet@gradle.com>
@Kantis
Copy link
Member

Kantis commented Mar 23, 2023

Looks good to me, but it's a bit beyond me. Would like to have @sksamuel eyes on this

@marcphilipp
Copy link
Contributor Author

@sksamuel Please let me know if you have any questions. I'd be happy to schedule a call with you if that makes it easier for you to review these changes.

@marcphilipp marcphilipp changed the title Expose discovered specs as TestDescriptors during discovery Expose discovered specs as TestDescriptors during discovery and add support for unique IDs Mar 29, 2023
@sksamuel
Copy link
Member

sksamuel commented Mar 29, 2023 via email

Copy link
Member

@sksamuel sksamuel left a comment

Choose a reason for hiding this comment

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

So the specs are added at discovery time. I've looked over the engine and I don't think we do any filtering after that point so it looks good to me.

Thanks for such a comprehensive PR.

@sksamuel sksamuel enabled auto-merge (squash) April 3, 2023 16:55
@sksamuel sksamuel merged commit eec48a9 into kotest:master Apr 4, 2023
17 checks passed
@marcphilipp
Copy link
Contributor Author

@sksamuel Thanks for the review and merging it! Should this PR be assigned to a milestone? Will it be released with 5.6? If so, do you have a rough estimate when that will be shipped?

@marcphilipp marcphilipp deleted the marc/unique-id-discovery branch April 4, 2023 07:08
@sksamuel
Copy link
Member

sksamuel commented Apr 4, 2023 via email

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

Successfully merging this pull request may close these issues.

None yet

3 participants