DocumentationGitHub Actions integration

GitHub Actions JUnit test reporting

Keep test execution in GitHub Actions. Add a launchable workflow contract, create JUnit XML, and retain the report on every run so QaCockpit can import it through the GitHub App.

01

Expose a safe workflow contract

A workflow launched from QaCockpit must support workflow_dispatch. QaCockpit discovers its declared inputs and sends only validated values from that allow-list together with the selected top-level Git ref.

.github/workflows/tests.yml
on:
  workflow_dispatch:
    inputs:
      scenario:
        description: Evidence scenario
        required: true
        default: green
        type: choice
        options: [green, failed-test, scope-drift]
  • Use typed, non-secret inputs for selectors such as browser, shard, or scenario.
  • Do not add an upload token or a required portal_run_id input.
  • Environment remains QaCockpit execution metadata unless your own workflow explicitly needs another input.
  • Artifact names and JUnit paths can follow your repository conventions.

02

Create and retain Playwright JUnit XML

Let the test step finish with a captured outcome, always upload the report and useful browser evidence, then restore the original failing conclusion. This prevents a failed test from skipping artifact retention or turning the job green.

GitHub Actions steps — Playwright
- name: Run Playwright and create JUnit XML
  id: tests
  continue-on-error: true
  env:
    PLAYWRIGHT_JUNIT_OUTPUT_FILE: test-results/junit.xml
  run: npx playwright test --reporter=junit

- name: Retain JUnit and browser evidence
  if: always()
  uses: actions/upload-artifact@v7
  with:
    name: playwright-test-evidence
    if-no-files-found: error
    retention-days: 14
    path: |
      test-results/junit.xml
      test-results/**
      playwright-report/**

- name: Preserve the test conclusion
  if: steps.tests.outcome == 'failure'
  run: exit 1

03

Retain Maven Surefire reports

Maven Surefire writes JUnit-style XML to target/surefire-reports by default. Retain every TEST-*.xml file because one test class commonly produces one report.

GitHub Actions steps — JUnit 5 and REST Assured
- name: Run REST Assured and create Surefire XML
  id: tests
  continue-on-error: true
  run: mvn --batch-mode test

- name: Retain JUnit XML and API diagnostics
  if: always()
  uses: actions/upload-artifact@v7
  with:
    name: rest-assured-test-evidence
    if-no-files-found: error
    retention-days: 14
    path: |
      target/surefire-reports/TEST-*.xml
      target/surefire-reports/*.txt
      target/test-evidence/**

- name: Preserve the test conclusion
  if: steps.tests.outcome == 'failure'
  run: exit 1

04

What happens after the workflow completes

  1. GitHub sends the signed workflow completion event to QaCockpit.
  2. QaCockpit resolves the exact workflow run and attempt for the Test Source.
  3. The GitHub App lists and downloads retained artifacts for that run.
  4. Compatible JUnit XML is discovered by content, normalized, and attached to the execution.
  5. Other retained files can remain available as protected failure evidence.
A completed workflow, imported result intake, and passed tests are three separate states. QaCockpit does not infer a passing test outcome from a green job alone.

05

Troubleshoot an execution awaiting results

  • Confirm the selected workflow and branch match the Test Source.
  • Open the run summary and verify that the JUnit artifact exists and is not empty.
  • Use if: always() so failed tests do not skip artifact retention.
  • Use a unique artifact name per matrix job; immutable artifacts cannot be extended by several jobs.
  • Refresh GitHub inventory after changing repository or workflow access.