achikin / testrail-jenkins-plugin

Integrate test results from Jenkins into TestRail(merged into jenkins main repo)
Apache License 2.0
27 stars 63 forks source link

results.xml sample #12

Open sebalanfranco opened 7 years ago

sebalanfranco commented 7 years ago

I´m getting the following error when I try to upload results to TestRail using this plugin. Could you please just provide a sample of the results.xml accepted by the plugin so we base on it to generate ours?

Started by user anonymous
Building in workspace /Users/sebastianlanfranco/TestRail-Jenkins-plugin/testrail-jenkins-plugin/work/workspace/automation
Munging test result files.
Scanning /var/folders/gz/pd5vv6rn27n6p5cvz52hk1c40000gn/T/hudson6821838021987083694tmp
processing hudson6821838021987083694tmp
processing results.xml
ERROR: Publisher testrail.testrail.TestRailNotifier aborted due to exception
org.json.JSONException: JSONObject["title"] not found.
    at org.json.JSONObject.get(JSONObject.java:473)
    at org.json.JSONObject.getString(JSONObject.java:654)
    at testrail.testrail.TestRailClient.createCaseFromJson(TestRailClient.java:264)
    at testrail.testrail.TestRailClient.addCase(TestRailClient.java:278)
    at testrail.testrail.TestRailObjects.ExistingTestCases.addCase(ExistingTestCases.java:112)
    at testrail.testrail.TestRailNotifier.addSuite(TestRailNotifier.java:172)
    at testrail.testrail.TestRailNotifier.perform(TestRailNotifier.java:123)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:772)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:736)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:685)
    at hudson.model.Run.execute(Run.java:1757)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)
Finished: FAILURE
sebalanfranco commented 7 years ago

@xirsoi or @szymonh sorry to bother you guys, do you have any results.xml sample since I´m getting some errors when trying to upload mine and there is not documentation about this plugin. Thanks in advance.

xirsoi commented 7 years ago

@sebalanfranco no problem, happy to help. The xml that the plugin accepts must comply with the xUnit Schema. Here's a very simple example:

`

`

xirsoi commented 7 years ago

Not sure why that wasn't formatted correctly...

EDIT: Just want to point out that that example is ridiculously simple. In the case of a fail, block, or error you would also include a message tag, which gives the reason for the failure/block/error.

sebalanfranco commented 7 years ago

Thank you @xirsoi for your answer! I really appreciate it. I find this plugin very helpful but I cannot get it working.

I´m still getting this error:

processing results.xml
ERROR: Publisher testrail.testrail.TestRailNotifier aborted due to exception
org.json.JSONException: JSONObject["title"] not found.
    at org.json.JSONObject.get(JSONObject.java:473)
    at org.json.JSONObject.getString(JSONObject.java:654)
    at testrail.testrail.TestRailClient.createCaseFromJson(TestRailClient.java:264)
    at testrail.testrail.TestRailClient.addCase(TestRailClient.java:278)
    at testrail.testrail.TestRailObjects.ExistingTestCases.addCase(ExistingTestCases.java:112)
    at testrail.testrail.TestRailNotifier.addSuite(TestRailNotifier.java:172)
    at testrail.testrail.TestRailNotifier.perform(TestRailNotifier.java:123)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:772)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:736)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:685)
    at hudson.model.Run.execute(Run.java:1757)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)
Finished: FAILURE
xirsoi commented 7 years ago

This appears to be an error related to creating new Test Cases in TestRail based on your test results. TestRail isn't responding with the data expected. I would double check the credentials you configured the plugin with (in Jenkins' Global Settings). Make sure the user you gave has permissions to create new test cases.

achikin commented 7 years ago

Hi guys. Sorry for not responding for a while. I'm not working with TestRail anymore, so it's hard for me to figure out the issues. If you willing to take over the pluging improvement/bugfixing - please feel free to do it.

xirsoi commented 7 years ago

I'd be willing to contribute more heavily. My company isn't using this plugin as a solution anymore, but we are still using TestRail and sending results to it, so I have some familiarity with the API.

sebalanfranco commented 7 years ago

Thank you @xirsoi ! I'll double check my credentials on TestRail and I'll back to you if you don't mind. No problem @achikin, thank you anyway. May I keep this issue open until I get a solution or find the root cause of my issue?

xirsoi commented 7 years ago

Make sure to also check the permissions for the TestRail user you've created.