mikepenz/xray-action

400 Error when importing Cucumber tests

scottmatth opened this issue · 4 comments

I have used this tool to import junitxml output of my pytests into XRay successfully. The format of the junitxml did not meet our needs so we are utilizing Cucumber tests now.

When attempting to import cucumber tests we received a 400 back from XRay. Their response to a ticket we entered said that the structure of the endpoint was invalid. I do not see how that is configurable on our end so it seems to be something in the Xray action. Here is what the endpoint looks like after enabling step debug logging:

##[debug]Using endpoint: https://xray.cloud.getxray.app//api/v2/import/execution/cucumber
Warning: 🔥 Failed to import: /home/runner/work/gpo/gpo/cucumberreport.json (Response code 400 (Bad Request))

As you can see, after getxray.app there are 2 slashes. Xray pointed this out as a potential issue.

is there any way to adjust this with the parameters we pass into Xray action, or is this a bug in the Xray action code when it comes to Cucumber tests (as I mentioned, we did not have an issue previously with JUnit.

Full information printed out with step debug

Using this:
https://github.com/marketplace/actions/xray-action

environment settings:
Run mikepenz/xray-action@v2
with:
username: ***
password: ***
testFormat: cucumber
testPaths: ./cucumberreport.json
projectKey: XTEST
xrayCloud: true
testMerge: true
combineInSingleTestExec: false
failOnImportError: false
continueOnImportError: true
importParallelism: 2

Execution and Error:
##[debug]Using endpoint: https://xray.cloud.getxray.app//api/v2/import/execution/cucumber
Warning: 🔥 Failed to import: /home/runner/work/gpo/gpo/cucumberreport.json (Response code 400 (Bad Request))
ℹ️ Processed 0 of 1 elements. Failed to import: 1

Thank you, I had not realized I was not using the latest version.

I made the change and I am still getting a 400 and am still getting the double slashes. The example in #621 seemed to deal with another area of the URL. Does it cover the same potential issue?

Run mikepenz/xray-action@v2.4.5
with:
username: ***
password: ***
testFormat: cucumber
testPaths: ./cucumberreport.json
projectKey: XTEST
xrayCloud: true
testMerge: true
combineInSingleTestExec: false
failOnImportError: false
continueOnImportError: true
importParallelism: 2
env:
FABRIC_PASSWORD: ***
FABRIC_API_KEY: ***
SLACK_API_KEY: ***
SLACK_CLIENT_SECRET: ***
pythonLocation: /opt/hostedtoolcache/Python/3.10.9/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.9/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.9/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.9/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.9/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.9/x64/lib
##[debug]GITHUB_WORKSPACE = '/home/runner/work/gpo/gpo'
##[debug]repositoryPath = '/home/runner/work/gpo/gpo'
::group::🚀 Connect to xray
🚀 Connect to xray
ℹ️ Configured XrayCloud
ℹ️ Start logging in procedure to xray
::add-mask::***
ℹ️ Completed login and retrieved token
::endgroup::
::group::📝 Import test reports
📝 Import test reports
ℹ️ Importing from: ./cucumberreport.json
ℹ️ Importing using format: cucumber
##[debug]followSymbolicLinks 'false'
##[debug]followSymbolicLinks 'false'
##[debug]implicitDescendants 'true'
##[debug]matchDirectories 'true'
##[debug]omitBrokenSymbolicLinks 'true'
##[debug]Search path '/home/runner/work/gpo/gpo/cucumberreport.json'
##[debug]Try to import: /home/runner/work/gpo/gpo/cucumberreport.json
##[debug]Using endpoint: https://xray.cloud.getxray.app//api/v2/import/execution/cucumber
Warning: 🔥 Failed to import: /home/runner/work/gpo/gpo/cucumberreport.json (Response code 400 (Bad Request))
ℹ️ Processed 0 of 1 elements. Failed to import: 1
::endgroup::
##[debug]Node Action run completed with exit code 0
##[debug]Set output testExecKey =
##[debug]Set output count = 1
##[debug]Set output completed = 0
##[debug]Set output failed = 1
##[debug]Finishing: Merge results up to XRay

I've determined that this was my error. my cucumber json file was not being constructed in the manner I thought it was. I have that corrected and the X-Ray action is now working properly.