C.W.K.
Stream
Lesson 07 of 13 · published

Test 리포팅

~11 min · reporting, junit, coverage

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

실패 찾으려고 raw log 읽지 마

CI 의 기본 test 출력은 콘솔 텍스트 벽이야. 진짜 test 리포팅은 구조화된 데이터 — 뭐가 통과했고 뭐가 실패했고 각각 얼마나 걸렸고 어디서 깨졌는지 — 추출해서 PR 이나 run summary 에 올려.

두 layer

1) Test 결과 포맷

  • JUnit XML — 범용. pytest --junitxml=report.xml, vitest --reporter=junit 등.
  • SARIF — 보안 스캐너용, PR review UI 에 표시.
  • Cobertura / lcov — coverage 포맷.

2) Renderer

  • GitHub Step Summary — 어떤 step 에서든 $GITHUB_STEP_SUMMARY 에 markdown 추가. Run 페이지에 렌더.
  • PR CommentEnricoMi/publish-unit-test-result-action 같은 third-party action 이 test run 요약 sticky 코멘트.
  • Coverage 배지 — Codecov 나 Coveralls 로 push; 그들의 action 도 PR 에 코멘트.
  • Annotation — step 에서 ::error file=foo.py,line=12::message emit 하면 GitHub 가 PR diff 에 인라인 annotation 그려.

Code

Step summary + JUnit + annotation·yaml
      - name: Run tests
        id: tests
        run: |
          pytest --junitxml=report.xml --cov=src --cov-report=term-missing | tee out.log

      - name: Append summary
        if: always()
        run: |
          echo '## Test summary' >> $GITHUB_STEP_SUMMARY
          tail -n 20 out.log >> $GITHUB_STEP_SUMMARY

      - name: Publish JUnit on PR
        if: always()
        uses: EnricoMi/publish-unit-test-result-action@v2
        with:
          files: report.xml

External links

Exercise

CI workflow 가져와 test 출력 마지막 30 줄 포함 step summary 추가. 최근 run 열어 summary 정확히 렌더되는지 확인.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.