Unable to import testng results to Xray

Meghana Mallineni January 5, 2023

I'm using xray-action in my maven.yml file and mentioned the testng results in that. 

Below is the error I get in the github actions workflow build while trying to import testng-results.xml. 

P.S The path mentioned in the error is correct one

 

Screen Shot 2023-01-05 at 6.25.00 PM.png

FYI: This is the documentation I followed https://docs.getxray.app/display/XRAYCLOUD/Integration+with+GitHub

1 answer

0 votes
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 8, 2023

Hi @Meghana Mallineni and welcome to the community,

Could you please share your API call from your yml that should do the import?

Best
Stefan

Meghana Mallineni January 9, 2023
steps:
- uses: actions/checkout@v2
- name: Set up JDK 14
uses: actions/setup-java@v1
with:
java-version: 14
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: clean build folders
run: mvn clean
- name: Build with Maven
run: mvn test
- name: Submit results to Xray
uses: mikepenz/xray-action@v2.3.0
if: always()
with:
username: ${{ secrets.jira_username }}
password: ${{ secrets.jira_password }}
testFormat: "testng"
testPaths: "**/surefire-reports/TEST-TestSuite.xml"
projectKey: "CT"
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2023

I see. tbh: I‘m more familiar with importing test results with built in API.

I did a quick research and found this:
https://github.com/mikepenz/xray-action

according to this documentation the call requires an testExec parameter which I could not find in your yml.

Please try to add this option and let us know the result.

Best
Stefan

Meghana Mallineni January 16, 2023

I tried another way too,

Run curl -H "Content-Type: text/xml" -X POST -H "Authorization: ***" --data @target/surefire-reports/testng-results.xml "https://xray.cloud.getxray.app/api/v2/import/execution/testng?projectKey=CT"

This is getting timeout. Screen Shot 2023-01-17 at 10.03.55 AM.png

{"error":"Import results request timed out! The import task is still running on the background."}

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 17, 2023

Hi @Meghana Mallineni 

Did you check these docs:
https://docs.getxray.app/display/XRAY/Import+Execution+Results+-+REST#ImportExecutionResultsREST-TestNGXMLresults
https://docs.getxray.app/display/XRAY/Taking+advantage+of+TestNG+XML+reports

Don´t ask me why but the docu says to use "Content-Type: multipart/form-data":

 

curl -H "Content-Type: multipart/form-data" -u admin:admin -F "file=@report.xml" http://yourserver/rest/raven/1.0/import/execution/testng?projectKey=XTP

 

Furthermore:

Xray supports TestNG 6.14 XML reports.

 

 

And:
Are you using the standard TestNG reporter or any other xml reporter (like eg. JUnit)?

 

Best
Stefan

Meghana Mallineni January 17, 2023

Hi I'm using Xray Cloud not Xray Server. 

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 17, 2023

Of course.....my bad :o 

Please appologize 🙏

Meghana Mallineni January 17, 2023

No worries, I'm using surefire-reports, results are present in this folder 

"target/surefire-reports/testng-results.xml
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 17, 2023

I just checked against my yml file where I import JUnit-xml.

There is a difference that I then also checked and found in the docu:

The docu has the file part in quotes but not the URL. In your call it´s exactly the other way round. So I would suggest to try the following:

 

curl -H "Content-Type: text/xml" -X POST -H "Authorization: ***" --data @"target/surefire-reports/testng-results.xml" https://xray.cloud.getxray.app/api/v2/import/execution/testng?projectKey=CT

 

Best
Stefan

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 17, 2023

I´m not sure about the different formats of reporters. 

Xray documentation mainly pointing out the one that are supported but I couldn´t find surefire. In case it doesn´t work I could imagine this has something to with the reporter´s format. If so I would suggest to rather change the reporter (TestNG standard or JUnit) or contact the vendor´s support.

Best
Stefan

Like Meghana Mallineni likes this
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 18, 2023

@Meghana Mallineni 

Did the quotes solve the problem?

Best
Stefan

Meghana Mallineni January 18, 2023

I tried to upload surefire xml file manually in the Test Execution issue Type in Xray and It didn't get uploaded. Looks like there's some problem with the xml file. 

Meghana Mallineni January 18, 2023

Is it mandatory to give the testExecKey in the curl command ? If so should we create a Test Execution Issue type before running the curl command ? 

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 20, 2023

Hi @Meghana Mallineni 

as far as I know:  the testExecKey is not mandatory (as long as there is the projectKey provided). If the project key is provided a new test execution is created with the results.

Nevertheless you could give it a shot if this works in your case.

Best
Stefan

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events