Skip to content

TestRail API was changed - may you update it to the latest structure? #67

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

Closed
maksimsarychau opened this issue Sep 20, 2021 · 20 comments
Closed

Comments

@maksimsarychau
Copy link
Contributor

Hello.
TestRail release the new API everywhere last weekend.
Changes are based on https://discuss.gurock.com/t/bulk-api-endpoint-changes-coming-soon/19537
And now all parses from this library stop worked. :(
I got errors like:
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
at [Source: (BufferedInputStream); line: 1, column: 1]
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:164)
at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:691)
at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:685)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.handleNonArray(CollectionDeserializer.java:256)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:214)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:204)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:23)
at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1270)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:865)
at com.codepine.api.testrail.Request.execute(Request.java:164)

@cameroncooks-branch
Copy link

+1 same issue here. If anyone creates a patch for this it would be greatly appreciated

@SaintDuriel
Copy link

Seconded, Unable to parse any responses from Test Rail with the latest update to their API.

@kbilokura
Copy link

+1 same issue here

@maksimsarychau
Copy link
Contributor Author

@kunal546 @apolaskey @ChenChiaHung as contributors - may you take a look?

@pwebster-cpi
Copy link

+1
For example, the get_cases endpoint now returns JSON like this:

{
    "offset": 0,
    "limit": 250,
    "size": 129,
    "_links": {
        "next": null,
        "prev": null
    },
    "cases": [
        {...

So the root node is not an instanceof ArrayNode and so can't be deserialized into a List? (I'm just guessing.)

@maksimsarychau
Copy link
Contributor Author

@pwebster-cpi yep. But not only for get_cases.
Following have to be updated as well.
get_cases
get_runs
get_results
get_tests
get_results_for_case
get_results_for_run
get_plans
get_projects
get_sections
get_milestones
get_history_for_case
get_attachments_for_case
get_attachments_for_run
Get_attachments_for_plan

But in some cases the old List is still actual.

@kbilokura
Copy link

Hi @maksimsarychau, I'm just interesting if you are going to use another library for testrail integration or wait for the fix?

@maksimsarychau
Copy link
Contributor Author

Hi @kbilokura, I didn't find any up-to-date and with such wide functionality :( If you find something - please let me know. I'm really waiting for a fix but in parallel trying to add direct API calls in my code as a workaround (without this library)

@pwebster-cpi
Copy link

I just saw this fork with changes made yesterday:
https://github.com/pablo-iglesias/testrail-api-java-client

I have not yet looked closely at it, but there is a new file named "PageDeserializer.java". Sounds promising...

@maksimsarychau
Copy link
Contributor Author

Thank you @pwebster-cpi
Just checked - it works for me with get_plans, get_projects, get_sections
But for other calls like List of get_cases or get_results showing the same error.
May you check as well?
Maybe I missed something in the updated syntax.

@cameroncooks-branch
Copy link

The https://github.com/pablo-iglesias/testrail-api-java-client fork worked for me, with a small bug fix re: _next URL's in the Request.java execute() method

@maksimsarychau
Copy link
Contributor Author

@pwebster-cpi Did you have a chance to check?
I found that solution from @pablo-iglesias works only for totally standard Testrail objects.
But if there is any custom field in any of the required List - there is a problem with parsing.
Logic with a bug starts from this line:
https://github.com/pablo-iglesias/testrail-api-java-client/blob/39d5e7d78f768220ccacdb16202115900d08899c/src/main/java/com/codepine/api/testrail/Request.java#L208

@maksimsarychau
Copy link
Contributor Author

The https://github.com/pablo-iglesias/testrail-api-java-client fork worked for me, with a small bug fix re: _next URL's in the Request.java execute() method
@cameroncooks-branch
May you share your fix?
Did you try to process with any custom fields in get_cases or get_results ?

@cameroncooks-branch
Copy link

The https://github.com/pablo-iglesias/testrail-api-java-client fork worked for me, with a small bug fix re: _next URL's in the Request.java execute() method
@cameroncooks-branch
May you share your fix?
Did you try to process with any custom fields in get_cases or get_results ?

I only needed the fix because my baseurl is https://www.demo.test/testing?/api/v2/
and the _next link was /api/v2/some/testrails/url

so when combined by getURL it would end up being https://www.demo.test/testing?/api/v2//api/v2/some/testrails/url

just a problem with not using an actual base baseurl

@pablo-iglesias
Copy link
Contributor

pablo-iglesias commented Oct 1, 2021

Hey,
Regarding my fork at https://github.com/pablo-iglesias/testrail-api-java-client
I have pushed a fix for both issues, custom fields, and strip api part from _next URL.
Be adviced that I will erase this fork in a few days.
Kind regards

@maksimsarychau
Copy link
Contributor Author

Really big thanks @pablo-iglesias. It works!
Just one small problem with a test G_casesExists_W_getCasesWithFilter_T_verifyFilterQueryAndCases() during mvn install.

Btw, where to I can order a coffee or cake (beer) for you? :)

@pablo-iglesias
Copy link
Contributor

Lol, you are welcome.
Sorry, I forgot to add the json file, I've just pushed it.
Remember, I will erase the fork in a few days.

@maksimsarychau
Copy link
Contributor Author

maksimsarychau commented Oct 4, 2021

Thanks for your help!
One more fix and pull request is available here:
#68
Does anybody have permission to merge?

@kunal546
Copy link
Contributor

kunal546 commented Oct 8, 2021

Sorry for the delay. I have merged this and made a new release v2.0.2.

@kunal546 kunal546 closed this as completed Oct 8, 2021
@eck-song
Copy link

eck-song commented Jun 13, 2022

Hi.

I am having the same problem with the revised version 2.0.2.

com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
 at [Source: java.io.BufferedInputStream@5fd1b2ea; line: 1, column: 1]
java.lang.RuntimeException: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token
 at [Source: java.io.BufferedInputStream@5fd1b2ea; line: 1, column: 1]

The code I use is as below.
val milestone: MutableList<Milestone> = testrail.Milestones().list(4).execute()

How should I use it?

@kunal546

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

No branches or pull requests

8 participants