diff --git a/.config/nextest.toml b/.config/nextest.toml index 89e92f0..b7284ed 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -30,6 +30,12 @@ test-threads = 4 failure-output = "final" status-level = "fail" +[profile.ci.junit] +# JUnit XML 輸出設定 - CI 環境專用 +path = "junit.xml" +store-success-output = true +store-failure-output = true + [profile.quick] # 快速測試設定 retries = 0 diff --git a/.github/workflows/build-test-audit-coverage.yml b/.github/workflows/build-test-audit-coverage.yml index c4eef53..632dca8 100644 --- a/.github/workflows/build-test-audit-coverage.yml +++ b/.github/workflows/build-test-audit-coverage.yml @@ -69,6 +69,15 @@ jobs: env: RUST_LOG: debug + # Upload test results to Codecov + - name: Upload test results to Codecov + if: ${{ always() }} + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: target/nextest/ci/junit.xml + flags: ${{ matrix.os }} + security: name: Security Audit runs-on: ubuntu-latest @@ -116,3 +125,12 @@ jobs: with: files: lcov.info fail_ci_if_error: false + + # Upload test results to Codecov + - name: Upload test results to Codecov + if: ${{ always() }} + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: target/nextest/ci/junit.xml + flags: coverage diff --git a/.gitignore b/.gitignore index dc373dd..8f23f23 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,7 @@ Thumbs.db # Environment variables .env *.log + +# JUnit XML test results +junit.xml +target/nextest/*/junit.xml diff --git a/docs/testing-guidelines.md b/docs/testing-guidelines.md index df388a1..bb3da18 100644 --- a/docs/testing-guidelines.md +++ b/docs/testing-guidelines.md @@ -650,6 +650,26 @@ fn test_with_performance_monitoring() { } ``` +## JUnit XML Test Results + +### Configuration +The project uses nextest to generate JUnit XML format test results, primarily for CI environments: + +```bash +# CI profile automatically generates JUnit XML +cargo nextest run --profile ci +``` + +### Output Location +- JUnit XML file: `target/nextest/ci/junit.xml` +- Contains detailed output and stack traces for all tests (successful and failed) + +### Codecov Test Analysis +Test results are automatically uploaded to Codecov, providing: +- Test execution time analysis +- Failure rate statistics +- Flaky test identification + ## Conclusion Following these guidelines ensures that SubX maintains high code quality, safety, and testability. The dependency injection architecture enables comprehensive testing without sacrificing safety or performance.