jenkinsci / testrail-plugin

Integrate test results from Jenkins into TestRail
Apache License 2.0
45 stars 35 forks source link

NullPointerException in TestRailNotifier #64

Open dmitrykrupa opened 3 years ago

dmitrykrupa commented 3 years ago

Version report

Jenkins and plugins versions report:

Plugin version - 1.0.7-SNAPSHOT
Jenkins version - any
Test Rail version - 7.2

Problem

In last Test Rail version has changed response format

Please Note: As of February 26, 2021 the data structure returned by bulk GET API endpoints will change. These bulk endpoints will no longer return an array of all entities, but will instead return an object with additional pagination fields and an array of up to 250 entities.To see the new response structure and test any necessary code changes, include the following header and value in your API requests: x-api-ident: beta.

New Response Content The response includes an array of test cases. Each test case in this list follows the same format as get_case.

{"offset": 0,
  "limit": 250,
  "size": 250,
  "_links":{
    "next": "/api/v2/get_cases/1&limit=250&offset=250",
    "prev": null
  },
  "cases":[
    { "id": 1, "title": "..", .. },
    { "id": 2, "title": "..", .. },
    ..
]
}

Reproduction steps

Results

Expected result: Successful publishing report to Test Rail.

Response format (and collecting data in List) should be changed in next methods:

Actual result:

Cannot find project or suite on TestRail server. Please check your Jenkins job and system configurations.
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.NullPointerException
    at org.jenkinsci.plugins.testrail.TestRailNotifier.perform(TestRailNotifier.java:105)
    at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:99)
    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:69)
    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
xirsoi commented 3 years ago

Thank you for the detailed report of the issue and the required solution. I'll do my damnedest to put some time into this very soon.

xirsoi commented 3 years ago

Did you build this from master or develop?

dmitrykrupa commented 3 years ago

From master.

dmitrykrupa commented 3 years ago

And please recheck next commit - https://github.com/jenkinsci/testrail-plugin/pull/51/commits/24890ddead17c1dd3bd153888360b3c6b588fcb0

image

In my opinion was forgotten required change to @XmlRootElement after renaming Class Should be @XmlRootElement(name = "testsuite")

AlVoronin commented 2 years ago

Facing the same issue. @xirsoi Is there any updates on that?

bronik commented 2 years ago

Hi there! I'm having the same issue( @xirsoi any updates?

xirsoi commented 2 years ago

I can't even get the dang project to build anymore. Until I do, if anyone can figure this issue out, I'll gladly review and approve a PR.

bronik commented 2 years ago

@xirsoi thanks for your answer! I have already built it and fix the problem (I think so:) ) today I'll try to install fixed plugin to my jenkins and check that it really works if everything fine - I'll send a PR to you

bronik commented 2 years ago

so, I fix that issue and got another one( https://gist.github.com/bronik/8b2694f084255109d5bb6f5fea00ab3f

I have no time to investigate cause of the error right now, but I'll try to fix it on the next week