mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-17 20:50:44 +00:00
test output updates:
- by default, make tests put all their output into files (under target/surefire-reports/) - with system property -DtestOutputToFile=false to get all output on console; - have circleci store that output as artifacts; - run mvn in 'batch mode' in circleci, for quieter output (no download progress, no color codes)
This commit is contained in:
@ -28,10 +28,55 @@ commands:
|
|||||||
- run:
|
- run:
|
||||||
name: Run Maven Verify
|
name: Run Maven Verify
|
||||||
command: |
|
command: |
|
||||||
mvn -s .circleci/mvn-settings.xml -T4 verify
|
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode verify
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: "*/target/site/jacoco/"
|
path: "*/target/site/jacoco/"
|
||||||
when: always
|
when: always
|
||||||
|
- store_artifacts:
|
||||||
|
path: "*/target/test-logs/"
|
||||||
|
when: always
|
||||||
|
- run:
|
||||||
|
name: Concatenate test output files
|
||||||
|
command: |
|
||||||
|
# Create artifacts directory
|
||||||
|
mkdir -p ~/test-output-artifacts/
|
||||||
|
|
||||||
|
# Find all module directories that have target/surefire-reports
|
||||||
|
for module_dir in */; do
|
||||||
|
if [ -d "${module_dir}target/surefire-reports" ]; then
|
||||||
|
module_name=$(basename "${module_dir%/}")
|
||||||
|
output_file="~/test-output-artifacts/${module_name}-test-output.txt"
|
||||||
|
|
||||||
|
echo "Processing module: ${module_name}"
|
||||||
|
echo "Output file: ${output_file}"
|
||||||
|
|
||||||
|
# Concatenate all .txt files in the surefire-reports directory
|
||||||
|
if [ -n "$(find "${module_dir}target/surefire-reports" -name "*.txt" -type f)" ]; then
|
||||||
|
echo "=== Test Output for ${module_name} ===" > "${output_file}"
|
||||||
|
echo "Generated at: $(date)" >> "${output_file}"
|
||||||
|
echo "==========================================" >> "${output_file}"
|
||||||
|
echo "" >> "${output_file}"
|
||||||
|
|
||||||
|
# Sort files to ensure consistent ordering
|
||||||
|
find "${module_dir}target/surefire-reports" -name "*.txt" -type f | sort | while read -r txt_file; do
|
||||||
|
echo "--- File: $(basename "${txt_file}") ---" >> "${output_file}"
|
||||||
|
cat "${txt_file}" >> "${output_file}"
|
||||||
|
echo "" >> "${output_file}"
|
||||||
|
echo "--- End of $(basename "${txt_file}") ---" >> "${output_file}"
|
||||||
|
echo "" >> "${output_file}"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Concatenated test output for ${module_name} to ${output_file}"
|
||||||
|
else
|
||||||
|
echo "No .txt files found in ${module_dir}target/surefire-reports"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
when: always
|
||||||
|
- store_artifacts:
|
||||||
|
path: ~/test-output-artifacts
|
||||||
|
destination: test-output
|
||||||
|
when: always
|
||||||
- run:
|
- run:
|
||||||
name: Save test results
|
name: Save test results
|
||||||
command: |
|
command: |
|
||||||
@ -54,8 +99,8 @@ commands:
|
|||||||
- run:
|
- run:
|
||||||
name: Build and Run ValidateApiVersions
|
name: Build and Run ValidateApiVersions
|
||||||
command: |
|
command: |
|
||||||
mvn -s .circleci/mvn-settings.xml -T4 install -DskipTests
|
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode install -DskipTests
|
||||||
mvn -s .circleci/mvn-settings.xml -pl qqq-middleware-javalin package appassembler:assemble -DskipTests
|
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode -pl qqq-middleware-javalin package appassembler:assemble -DskipTests
|
||||||
qqq-middleware-javalin/target/appassembler/bin/ValidateApiVersions -r $(pwd)
|
qqq-middleware-javalin/target/appassembler/bin/ValidateApiVersions -r $(pwd)
|
||||||
|
|
||||||
mvn_jar_deploy:
|
mvn_jar_deploy:
|
||||||
@ -71,7 +116,7 @@ commands:
|
|||||||
- run:
|
- run:
|
||||||
name: Run Maven Jar Deploy
|
name: Run Maven Jar Deploy
|
||||||
command: |
|
command: |
|
||||||
mvn -s .circleci/mvn-settings.xml -T4 flatten:flatten jar:jar deploy:deploy
|
mvn -s .circleci/mvn-settings.xml -T4 --batch-mode flatten:flatten jar:jar deploy:deploy
|
||||||
- save_cache:
|
- save_cache:
|
||||||
paths:
|
paths:
|
||||||
- ~/.m2
|
- ~/.m2
|
||||||
|
14
README.md
14
README.md
@ -30,6 +30,20 @@ There are a few useful IntelliJ settings files, under `qqq-dev-tools/intellij`:
|
|||||||
One will likely also want the [Kingsrook Commentator
|
One will likely also want the [Kingsrook Commentator
|
||||||
Plugin](https://plugins.jetbrains.com/plugin/19325-kingsrook-commentator).
|
Plugin](https://plugins.jetbrains.com/plugin/19325-kingsrook-commentator).
|
||||||
|
|
||||||
|
## Test Logging
|
||||||
|
By default, when ran from the command line, mvn surefire will make each test's
|
||||||
|
output (e.g., System.out, err, printStackTrace, and all logger calls) go into a
|
||||||
|
file under target/surefire-reports/${className}.txt.
|
||||||
|
|
||||||
|
The system property `-DtestOutputToFile=false` can be given on the command line
|
||||||
|
to get all of this output on the console.
|
||||||
|
|
||||||
|
In the IDE (e.g,. IntelliJ), output goes to the Console.
|
||||||
|
|
||||||
|
In CircleCI, output goes to files, and those files are concatenated together and
|
||||||
|
stored as artifacts.
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
QQQ - Low-code Application Framework for Engineers. \
|
QQQ - Low-code Application Framework for Engineers. \
|
||||||
Copyright (C) 2020-2024. Kingsrook, LLC \
|
Copyright (C) 2020-2024. Kingsrook, LLC \
|
||||||
|
8
pom.xml
8
pom.xml
@ -59,6 +59,7 @@
|
|||||||
<coverage.instructionCoveredRatioMinimum>0.80</coverage.instructionCoveredRatioMinimum>
|
<coverage.instructionCoveredRatioMinimum>0.80</coverage.instructionCoveredRatioMinimum>
|
||||||
<coverage.classCoveredRatioMinimum>0.95</coverage.classCoveredRatioMinimum>
|
<coverage.classCoveredRatioMinimum>0.95</coverage.classCoveredRatioMinimum>
|
||||||
<plugin.shade.phase>none</plugin.shade.phase>
|
<plugin.shade.phase>none</plugin.shade.phase>
|
||||||
|
<testOutputToFile>true</testOutputToFile>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
@ -141,6 +142,8 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<!-- Sets the VM argument line used when integration tests are run. -->
|
<!-- Sets the VM argument line used when integration tests are run. -->
|
||||||
<argLine>@{jaCoCoArgLine}</argLine>
|
<argLine>@{jaCoCoArgLine}</argLine>
|
||||||
|
<!-- Reduce console output for cleaner JUnit output -->
|
||||||
|
<redirectTestOutputToFile>${testOutputToFile}</redirectTestOutputToFile>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
@ -249,10 +252,9 @@ echo " See also target/site/jacoco/index.html"
|
|||||||
echo " and https://www.jacoco.org/jacoco/trunk/doc/counters.html"
|
echo " and https://www.jacoco.org/jacoco/trunk/doc/counters.html"
|
||||||
echo "------------------------------------------------------------"
|
echo "------------------------------------------------------------"
|
||||||
|
|
||||||
# Parse Jacoco HTML coverage summary using grep and sed
|
# Parse Jacoco HTML coverage summary
|
||||||
if [ -f target/site/jacoco/index.html ]; then
|
if [ -f target/site/jacoco/index.html ]; then
|
||||||
echo -e "Instructions Missed\nInstruction Coverage\nBranches Missed\nBranch Coverage\nComplexity Missed\nComplexity Hit\nLines Missed\nLines Hit\nMethods Missed\nMethods Hit\nClasses Missed\nClasses Hit\n" > /tmp/$$headers
|
echo -e "Instructions Missed\nInstruction Coverage\nBranches Missed\nBranch Coverage\nComplexity Missed\nComplexity Hit\nLines Missed\nLines Hit\nMethods Missed\nMethods Hit\nClasses Missed\nClasses Hit\n" > /tmp/$$.headers
|
||||||
# Extract values from the footer row of the coverage table
|
|
||||||
sed 's/<\/\w\+>/&\n/g' target/site/jacoco/index.html | grep -A 12 '<tfoot>' | grep '<td' | sed 's/<td class="\w\+\d*">\([^<]*\)<\/td>/\1/' | grep -v Total > /tmp/$$.values
|
sed 's/<\/\w\+>/&\n/g' target/site/jacoco/index.html | grep -A 12 '<tfoot>' | grep '<td' | sed 's/<td class="\w\+\d*">\([^<]*\)<\/td>/\1/' | grep -v Total > /tmp/$$.values
|
||||||
paste /tmp/$$.headers /tmp/$$.values | tail +2 | awk -v FS='\t' '{printf("%-20s %s\n",$1,$2)}'
|
paste /tmp/$$.headers /tmp/$$.values | tail +2 | awk -v FS='\t' '{printf("%-20s %s\n",$1,$2)}'
|
||||||
rm /tmp/$$.headers /tmp/$$.values
|
rm /tmp/$$.headers /tmp/$$.values
|
||||||
|
Reference in New Issue
Block a user