Skip to content

Automatically create test results elements for each test suite#31706

Merged
big-guy merged 1 commit into
masterfrom
jvandort/testing/aggregation/automatically-create-results-elements-for-each-suite
Dec 18, 2024
Merged

Automatically create test results elements for each test suite#31706
big-guy merged 1 commit into
masterfrom
jvandort/testing/aggregation/automatically-create-results-elements-for-each-suite

Conversation

@jvandort

@jvandort jvandort commented Dec 13, 2024

Copy link
Copy Markdown
Member

Previously, we created a binary test results elements for each test target. When performing aggregation, this only worked if the target test suite had a single target. Otherwise, we'd run into ambiguity.

To resolve this for multi-target test suites, we only create a single variant for each suite and add all test results variants for all targets to the suite's variant. This means when aggregating against a project, we will aggregate the results of all targets.

Eventually we will want to go back to a test results variant for each target, but until we have the targets able to declare their identity via attributes, we will have a single variant per suite.

We remove the concept of a test suite type, as this was a very simple mapping over the suite name, and only differed for the case of the default test suite, which has a test type of UNIT_TEST instead of its suite name. We will eventually want to not use the suite name as an attribute either, but rather use the suite name as part of a capability.

The reports will eventually want to use attributes to distinguish which targets to aggregate instead of aggregating all targets from each suite.

We also make similar changes to Jacoco.

Reviewing cheatsheet

Before merging the PR, comments starting with

  • ❌ ❓must be fixed
  • 🤔 💅 should be fixed
  • 💭 may be fixed
  • 🎉 celebrate happy things

@jvandort jvandort force-pushed the jvandort/testing/aggregation/automatically-create-results-elements-for-each-suite branch from 8dfdd58 to 212a951 Compare December 17, 2024 06:33
@jvandort

This comment has been minimized.

@bot-gradle

This comment has been minimized.

@jvandort

This comment has been minimized.

@jvandort jvandort requested a review from big-guy December 17, 2024 06:48
@bot-gradle

This comment has been minimized.

@bot-gradle

This comment has been minimized.

@bot-gradle

This comment has been minimized.

@jvandort jvandort force-pushed the jvandort/testing/aggregation/automatically-create-results-elements-for-each-suite branch from 212a951 to 26f9745 Compare December 17, 2024 16:24
@jvandort

This comment has been minimized.

@bot-gradle

This comment has been minimized.

@jvandort jvandort force-pushed the jvandort/testing/aggregation/automatically-create-results-elements-for-each-suite branch from 26f9745 to bce02ad Compare December 17, 2024 17:19
@jvandort

This comment has been minimized.

@jvandort jvandort marked this pull request as ready for review December 17, 2024 17:19
@jvandort jvandort requested review from a team as code owners December 17, 2024 17:19
@jvandort jvandort requested review from a team December 17, 2024 17:19
@bot-gradle

This comment has been minimized.

@jvandort jvandort force-pushed the jvandort/testing/aggregation/automatically-create-results-elements-for-each-suite branch from bce02ad to fc5be0d Compare December 17, 2024 17:22
@bot-gradle

This comment has been minimized.

@jvandort

This comment has been minimized.

@bot-gradle

This comment has been minimized.

@jvandort jvandort self-assigned this Dec 17, 2024
@jvandort jvandort added this to the 8.13 RC1 milestone Dec 17, 2024
@bot-gradle

Copy link
Copy Markdown
Collaborator

The following builds have failed:

@bot-gradle

Copy link
Copy Markdown
Collaborator

The following builds have failed:

@jvandort jvandort force-pushed the jvandort/testing/aggregation/automatically-create-results-elements-for-each-suite branch from fc5be0d to 669ee1f Compare December 17, 2024 19:53
Previously, we created a binary test results elements for each test target.
When performing aggregation, this only worked if the target test suite had a single target. Otherwise, we'd run into ambiguity.

To resolve this for multi-target test suites, we only create a single variant for each sutie and add all test results variants for all targets to the suite's variant.
This means when aggregating against a project, we will aggregate the results of all targets.

Eventually we will want to go back to a test results variant for each target, but until we have the targets able to declare their identity via attributes, we will have a single variant per suite.

We remove the concept of a test suite type, as this was a very simple mapping over the suite name, and only differed for the case of the default test suite, which has a test type of UNIT_TEST instead of its suite name.
We will eventually want to not use the suite name as an attribute either, but rather use the suite name as part of a capability.

The reports will eventually want to use attributes to distinguish which targets to aggregate instead of aggregating all targets from each suite.

We also make similar changes to Jacoco.
@jvandort jvandort force-pushed the jvandort/testing/aggregation/automatically-create-results-elements-for-each-suite branch from 669ee1f to 0d03a85 Compare December 17, 2024 19:56
@jvandort

Copy link
Copy Markdown
Member Author

@bot-gradle test this

@bot-gradle

This comment has been minimized.

@bot-gradle

Copy link
Copy Markdown
Collaborator

The following builds have passed:

@big-guy big-guy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As a follow up, please add something to the upgrade guide that warns about changes in the JaCoCo and test suite plugins + aggregation.


package org.gradle.testing.base.plugins;

import org.apache.commons.lang3.StringUtils;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we keep using org.apache.commons.lang.StringUtils? I'm not sure why we have both versions...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Shouldn't we prefer lang3 over lang?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bah, it looks like we have a mix of both. I thought we were only using lang, not lang3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I guess lang3 is good enough. Ignore me

@big-guy big-guy added this pull request to the merge queue Dec 17, 2024
Merged via the queue into master with commit ad7bf06 Dec 18, 2024
@big-guy big-guy deleted the jvandort/testing/aggregation/automatically-create-results-elements-for-each-suite branch December 18, 2024 00:25
@jvandort

Copy link
Copy Markdown
Member Author

@big-guy #31809

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.

3 participants