Back to Workflow Core

Enhanced Test Reporting for GitHub Actions

docs/enhanced-test-reporting.md

3.17.04.7 KB
Original Source

Enhanced Test Reporting for GitHub Actions

This document explains the enhanced test reporting capabilities that have been added to the GitHub Actions workflow.

Overview

The GitHub Actions workflow has been enhanced to provide detailed, individual test results for all test suites in the Workflow Core project. This addresses the requirement to see detailed, individual test results from tests run by GitHub workflows.

Key Enhancements

1. Detailed Test Output

  • Enhanced Verbosity: Changed from --verbosity normal to --verbosity detailed
  • Detailed Console Logging: Added --logger "console;verbosity=detailed" for comprehensive console output
  • Individual Test Results: Each test case now shows its execution status, duration, and any error details

2. TRX Test Result Files

  • TRX Format: Added --logger "trx;LogFileName={TestSuite}.trx" to generate XML test result files
  • Structured Data: TRX files contain structured test data including:
    • Test names and fully qualified names
    • Test outcomes (Passed, Failed, Skipped)
    • Execution times and durations
    • Error messages and stack traces for failed tests
    • Test categories and traits

3. GitHub Actions Test Reporting

  • Test Reporter Integration: Added dorny/test-reporter@v1 action to display test results in the GitHub UI
  • PR Integration: Test results are automatically displayed in pull request checks
  • Visual Test Summary: Failed tests are highlighted with detailed error information
  • Test Status Annotations: Test results appear as GitHub Actions annotations

4. Test Result Artifacts

  • Downloadable Results: Test result files are uploaded as artifacts for each job
  • Persistent Storage: Test results are available for download even after workflow completion
  • Individual Job Results: Each test suite (Unit, Integration, MongoDB, etc.) has separate artifacts

What You'll See

In GitHub Actions Logs

Before (old format):

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Passed!  - Failed:     0, Passed:    25, Skipped:     0, Total:    25

After (enhanced format):

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

  Passed WorkflowCore.UnitTests.Services.ExecutionResultProcessorFixture.should_advance_workflow [< 1 ms]
  Passed WorkflowCore.UnitTests.Services.ExecutionResultProcessorFixture.should_branch_children [2 ms]
  Failed WorkflowCore.UnitTests.Services.SomeTest.example_failing_test [15 ms]
    Error Message:
     Assert.Equal() Failure
     Expected: True
     Actual:   False
    Stack Trace:
      at WorkflowCore.UnitTests.Services.SomeTest.example_failing_test() in /path/to/test.cs:line 42

Test Run Summary:
  Total tests: 25
    Passed: 24
    Failed: 1
    Skipped: 0

In GitHub Pull Requests

  • Test Status Checks: Clear pass/fail status for each test suite
  • 📊 Test Summary: Number of passed, failed, and skipped tests
  • 🔍 Detailed Failure Information: Click-through to see specific test failures
  • 📁 Downloadable Artifacts: Access to complete test result files

Available Artifacts

Each test job now produces downloadable artifacts:

  • unit-test-results: Unit test TRX files and logs
  • integration-test-results: Integration test TRX files and logs
  • mongodb-test-results: MongoDB-specific test results
  • mysql-test-results: MySQL-specific test results
  • postgresql-test-results: PostgreSQL-specific test results
  • redis-test-results: Redis-specific test results
  • sqlserver-test-results: SQL Server-specific test results
  • elasticsearch-test-results: Elasticsearch-specific test results
  • oracle-test-results: Oracle-specific test results

Benefits

  1. Individual Test Visibility: See exactly which tests pass or fail
  2. Debugging Support: Detailed error messages and stack traces
  3. Performance Monitoring: Test execution times for performance analysis
  4. Historical Data: Downloadable test results for trend analysis
  5. CI/CD Integration: Better integration with GitHub's native test reporting features
  6. Developer Experience: Faster identification of test issues in pull requests

File Structure

After test execution, the following files are generated:

test-results/
├── UnitTests.trx
├── IntegrationTests.trx
├── MongoDBTests.trx
├── MySQLTests.trx
├── PostgreSQLTests.trx
├── RedisTests.trx
├── SQLServerTests.trx
├── ElasticsearchTests.trx
└── OracleTests.trx

Each TRX file contains detailed XML data about the test execution results that can be consumed by various reporting tools and integrated development environments.