Files

32 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Regenerates every file in spring-test-slices/output/.
# Needs JDK 25 and Maven on the PATH. Takes about a minute.
set -euo pipefail
cd "$(dirname "$0")/.."
OUT=output
# keep transcripts free of JVM launcher noise that varies per machine
filter() { grep -vE '^(Picked up JAVA_TOOL_OPTIONS|WARNING: )' || true; }
rm -f "$OUT"/*.txt
mkdir -p "$OUT"
# 1. the whole suite: every test writes its own transcript to output/ and asserts the same facts
mvn -B -q clean test 2>&1 | filter | grep -E 'Tests run:|BUILD|ERROR' || true
# 2. which test jars does spring-boot-starter-test alone bring in?
./scripts/starter-test-only.sh
# 3. startup time of each context, one test class per JVM so nothing is cached.
# Spring Boot logs "Started <TestClass> in N seconds" for every context it builds.
# Timings vary by machine and by run: read them as indicative, not as a result.
{
echo "Context startup time per test class (one class per mvn run; indicative, varies between runs)"
echo
for cls in JsonSliceTest RestClientSliceTest WebMvcSliceTest DataJpaSliceTest FullContextTest; do
mvn -B test -Dtest="$cls" 2>&1 | grep -oE "Started $cls in [0-9.]+ seconds" | head -1
done
} > "$OUT/30-startup-times.txt"
echo "done: $(ls "$OUT" | wc -l) files in $OUT/"