Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable "no test annotations available" text when skip annotations is true #1287

Closed
itsdinesh opened this issue Jan 20, 2025 · 3 comments · Fixed by #1289 or #1291
Closed

Disable "no test annotations available" text when skip annotations is true #1287

itsdinesh opened this issue Jan 20, 2025 · 3 comments · Fixed by #1289 or #1291

Comments

@itsdinesh
Copy link

Hi @mikepenz,

Could the No test annotations available text be disabled when skip_annotations: true is used? Also, could the test result table be omitted if all test cases pass, and only displayed when there are failed cases?

I'm aiming to make the GitHub summary more simpler to read, let me know about your thoughts, thanks!

Image

My current config:

- name: Generate test result
  uses: mikepenz/action-junit-report@v5
  with:
     fail_on_failure: true
     detailed_summary: true
     skip_annotations: true
     check_name: Test 1
@mikepenz
Copy link
Owner

Hi @itsdinesh

It sounds like you are basically trying not to have a summary if the tests did not fail?
The cleanest solution for that would probably be to not even run the action if the tests passed.

@itsdinesh
Copy link
Author

itsdinesh commented Jan 24, 2025

Hi @mikepenz,

I'm using your action to generate the GitHub step summary of the test results. My goal is to show the pass/fail status to the user but avoid showing the detailed summary when all tests pass. Currently, I managed to implement it by using outputs from the action and then build the step summary from it.

echo '<h2>Test Summary</h2>' >> "$GITHUB_STEP_SUMMARY"
echo '${{ needs.main.outputs.summary }}' >> "$GITHUB_STEP_SUMMARY"
if [ "${{ needs.main.outputs.failed }}" -gt 0 ]; then
    echo '<h2>Failed Cases</h2>' >> "$GITHUB_STEP_SUMMARY"
    echo '${{ needs.main.outputs.detailed_summary }}' >> "$GITHUB_STEP_SUMMARY"
fi

But, the problem I'm facing currently is that the detailed summary includes no test annotations available rows mixed with failed test cases, making the GitHub step summary hard to read. I just want to use the detailed summary to tell the user which test cases had failed so having an option to stop generating that generic text would be great. See example below.

Current detailed summary output:

Test Result
No test annotations available
No test annotations available
Test 3
SingleJUnitTestRunner$DescriptionAsTest.testErrorWrongField ❌ failure
No test annotations available

Desired detailed summary output:

Test Result
Test 3
SingleJUnitTestRunner$DescriptionAsTest.testErrorWrongField ❌ failure

This is my current config with multiple reports:

- name: Generate test result
  id: generate-result
  uses: mikepenz/action-junit-report@v5
  with:
    fail_on_failure: true
    skip_annotations: true
    job_summary: false
    detailed_summary: true
    check_name: |
      Test 1
      Test 2
      Test 3
      Test 4
    report_paths: |
      ${{ github.workspace }}/reports/test1/reports/*.xml
      ${{ github.workspace }}/reports/test2/reports/*.xml
      ${{ github.workspace }}/reports/test3/reports/*.xml
      ${{ github.workspace }}/reports/test4/reports/*.xml

@itsdinesh
Copy link
Author

Thanks for implementing the changes, @mikepenz 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants