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

Maven failsafe plugin reports parsing fails: [Error: Cannot read properties of undefined (reading 'testsuite')] #184

Closed
dejan-stojadinovic opened this issue Oct 2, 2023 · 5 comments · Fixed by #198

Comments

@dejan-stojadinovic
Copy link

Configuration:

    - name: Publish Failsafe Test Report
      if: success() || failure()
      uses: scacap/action-surefire-report@v1.7.2
      with:
        report_paths: "**/failsafe-reports/*.xml"

Maven plugin version:

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>3.1.2</version>
                    </plugin>

Github Actions workflow error:

Run scacap/action-surefire-report@v1.7.2
  with:
    report_paths: **/failsafe-reports/*.xml
    github_token: ***
    create_check: true
    check_name: Test Report
    fail_on_test_failures: false
    fail_if_no_tests: true
    skip_publishing: false
    file_name_in_stack_trace: false
  env:
    ECR_AWS: *************
    JAVA_HOME: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.8-1/x64
    JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.8-1/x64
Going to parse results form **/failsafe-reports/*.xml
Error: Cannot read properties of undefined (reading 'testsuite')

Note: can't share code, repository is private.

@robbie-cronometer
Copy link

robbie-cronometer commented Dec 21, 2023

Also encountering the same issue:

        steps:
    - uses: actions/checkout@v3
    - name: Set up JDK 21
      uses: actions/setup-java@v3
      with:
        java-version: '21'
        distribution: 'temurin'
        cache: maven
    - name: Server Integration Tests
      run: mvn --errors --debug verify <REDACTED>
    - name: Report Test Results
      if: success() || failure()
      uses: scacap/action-surefire-report@v1
      with:
        report_paths: target/failsafe-reports/*.xml

Maven Plugin version:
<maven.plugins.version>3.0.0</maven.plugins.version>

Same error as previous

@robbie-cronometer
Copy link

robbie-cronometer commented Dec 21, 2023

Ah, this is due to it picking up the summary file (failsafe-summary.xml) which appears in the failsafe-reports directory!

report_paths: **/failsafe-reports/*.xml

Changing to **/failsafe-reports/TEST-*.xml should fix this.

While this is a misconfiguration, I do feel like it's a bit of a footgun and should probably be addressed more gracefully in the code, at the very least report the file that caused the error in the output.

This should work for you too @dejan-stojadinovic dejan-stojadinovic

@ghaiszaher
Copy link
Member

@dejan-stojadinovic @robbie-cronometer thank you for reporting the issue. Unfortunately we don't have the capacity to look into this at the moment, but I'll try to find a fix next month.

If you already have an idea on how to fix or improve the error visibility, feel free to raise a pull request.

@rahulshrivastava-eaton
Copy link

I too facing this issue while parsing the testng-results.xml , it says Cannot read properties of undefined (reading 'testsuite'), @ghaiszaher any workaround for now ?

ghaiszaher added a commit that referenced this issue Jan 15, 2024
Fixes #184

Ignore files that don't have testsuites
Reorganize the folders
@ghaiszaher
Copy link
Member

@dejan-stojadinovic @robbie-cronometer @rahulshrivastava-eaton this should be fixed with v1.7.3. Please reopen if you still face the issue.

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

Successfully merging a pull request may close this issue.

4 participants