instancio: Instancio 6.1 lab (selectors, settings, seeds, records/sealed/generics, JUnit 6 extension, failing-seed capture)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b4VQVEJWetTT1dYzyJ
This commit is contained in:
2026-10-29 05:51:26 +00:00
co-authored by Claude Sonnet 5.5
parent 9d89323864
commit 11782a7ec3
39 changed files with 1053 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Records what Instancio prints when a test fails, and how to reproduce it with @Seed.
# FailingSeedDemoTest fails on purpose, so every mvn call here is allowed to exit non-zero.
set -uo pipefail
cd "$(dirname "$0")/.."
clean() { grep -v -E '^(Picked up JAVA_TOOL_OPTIONS|WARNING:)' | grep -v -E '^\[INFO\] (Total time|Finished at)'; }
# 1. default classpath: no SLF4J provider, so the seed summary (logged via SLF4J) is dropped
RAW=$(mvn -B -T1 test -Dtest=FailingSeedDemoTest -Dlab.demo=fail 2>&1 | clean)
{
echo '$ mvn test -Dtest=FailingSeedDemoTest -Dlab.demo=fail'
echo "$RAW" | sed -n '/Running lab.instancio.FailingSeedDemoTest/,/Tests run: 40, Failures: [0-9]*, Errors: 0, Skipped: 0$/p' \
| grep -v -E '^\[INFO\] (BUILD|---|$)' | grep -v '^\s*at '
echo "lines containing '@Seed' in the whole Maven output: $(echo "$RAW" | grep -c '@Seed')"
} > output/16-failing-test-without-slf4j.txt
# 2. with an SLF4J provider (profile seed-log adds slf4j-simple) the summary appears
{
echo '$ mvn test -Pseed-log -Dtest=FailingSeedDemoTest -Dlab.demo=fail'
mvn -B -T1 test -Pseed-log -Dtest=FailingSeedDemoTest -Dlab.demo=fail 2>&1 | clean \
| sed -n '/Running lab.instancio.FailingSeedDemoTest/,/Tests run: 40, Failures: [0-9]*, Errors: 0, Skipped: 0$/p' \
| grep -v -E '^\[INFO\] (BUILD|---|$)' | grep -v '^\s*at '
} > output/17-failing-test-seed-summary.txt
# 3. the same assertion, pinned with a seed copied from a summary like the one above
{
echo '$ mvn test -Pseed-log -Dtest=ReproduceFailureDemoTest -Dlab.demo=reproduce (run 1)'
mvn -B -T1 test -Pseed-log -Dtest=ReproduceFailureDemoTest -Dlab.demo=reproduce 2>&1 | clean \
| grep -E 'Tests run:.*in lab|AssertionFailedError|@Seed' | head -4
echo '$ same command again (run 2)'
mvn -B -T1 test -Pseed-log -Dtest=ReproduceFailureDemoTest -Dlab.demo=reproduce 2>&1 | clean \
| grep -E 'Tests run:.*in lab|AssertionFailedError|@Seed' | head -4
} > output/18-reproduced-with-seed.txt
echo "captured: $(ls output | wc -l) files"