Skip to content

Conversation

sschuberth
Copy link
Member

Please have a look at the individual commit messages for the details.

@sschuberth sschuberth requested a review from a team as a code owner September 22, 2025 16:36
@sschuberth sschuberth enabled auto-merge (rebase) September 22, 2025 16:36
Copy link

codecov bot commented Sep 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.53%. Comparing base (e3827d0) to head (96c0cb3).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #10880   +/-   ##
=========================================
  Coverage     57.53%   57.53%           
+ Complexity     1700     1698    -2     
=========================================
  Files           346      346           
  Lines         12823    12823           
  Branches       1212     1212           
=========================================
  Hits           7378     7378           
  Misses         4978     4978           
  Partials        467      467           
Flag Coverage Δ
funTest-docker 70.98% <ø> (ø)
funTest-non-docker 32.87% <ø> (-0.12%) ⬇️
test-ubuntu-24.04 42.25% <ø> (ø)
test-windows-2025 42.23% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sschuberth sschuberth requested review from fviernau and a team September 22, 2025 20:39
implementation(project(":utils:test-utils"))

implementation(libs.kotest.assertions.core)
implementation(libs.kotest.property)
Copy link
Member

@fviernau fviernau Sep 22, 2025

Choose a reason for hiding this comment

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

just curious: What is the experiment after? What is the unkown and how can we make use of outcome?

I've a bit doubts that generating "meaningful" test data, is valuable for parameter values which do not matter. E.g. the need to emphasize (by using arbs) could also be a code smell hinting at suboptimal clarity.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've a bit doubts that generating "meaningful" test data, is valuable for parameter values which do not matter. E.g. the need to emphasize (by using arbs) could also be a code smell hinting at suboptimal clarity.

I see it pretty much as the opposite: Arb (which is short for "arbitrary") deliberately creates "unmeaningful" test data to emphasize that the test should work for any value, and not just for the hard-coded one. This also creates a chance to uncover edge-case bugs in tests where a test only works for an existing hard-coded value, whereas it should generally work. It's a little bit like fuzzing.

So I see it as clarity being added by deliberately using arbitrary / random values.

What is the experiment after? What is the unkown and how can we make use of outcome?

Eventually, I hope to get rid of e.g. some EMPTY constants that we have for many data classes. That's because these constants are very often only used in tests, and in places where the data should not actually be empty, but where we do not care about concrete values, so actually the data should be arbitrary.

Copy link
Member

Choose a reason for hiding this comment

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

LGTM, but let's get a second approval.

@sschuberth sschuberth requested review from fviernau and a team September 23, 2025 07:24
See [1]. Going forward, as an experiment some tests will be converted to
use arbitrary (reflective) values [2] where no fixed empty / dummy values
are strictly needed, to emphasize the invariance on those inputs.

[1]: https://kotest.io/docs/proptest/property-based-testing.html
[2]: https://kotest.io/docs/proptest/reflective-arbs.html

Signed-off-by: Sebastian Schuberth <[email protected]>
Emphasize that the `File` argument does not matter for the test by using
an arbitrary value instead.

Signed-off-by: Sebastian Schuberth <[email protected]>
"Project files from vendor directories are ignored" {
val projectFiles = ComposerFactory.create().mapDefinitionFiles(
File("."),
Arb.file().single(),
Copy link
Member Author

Choose a reason for hiding this comment

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

@mnonnenmacher, I found a little bit of a nicer syntax here.

Copy link
Member

Choose a reason for hiding this comment

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

It's better, but if Kotest would provide a function like arbitraryFile() (and arbitraryFiles() for the not single case) it would make the tests more readable.

@fviernau fviernau disabled auto-merge September 23, 2025 12:16
@sschuberth sschuberth merged commit b0bc10f into main Sep 23, 2025
27 checks passed
@sschuberth sschuberth deleted the arb-file-testing branch September 23, 2025 21:01
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