Nike
Nike

Reputation: 23

Replicating new artefacts from Gitlab to Jira XRAY Repository

Introduction
Suppose, if I create a new Test (lets name that TEST-100) in Jira and then I push the same to Gitlab to utilize this in a CI pipeline.

Now, if I have move this TEST-100 to folder "Root/Technical" in Gitlab, the test should also move to the XRAY Test Repository "Root/Technical".

Already Tried
I have tried to follow the steps mentioned in https://docs.getxray.app/display/XRAY/Test+Repository+-+REST but not much success has been achieved. I have already to send the request as

curl -i -H "Content-Type: application/json" -X PUT -u $jira_user:$jira_password --data '{"tests":[{"rank": 1,"id": 29600,"key": "TEST-120","summary": "Test Summary Headline - TEST 100","priority": "Lowest","assignee": "User123","workflowStatus": "ACTIVE","components": [],"testType":"Cucumber"}]}' "https://jiraserverhost.com/rest/raven/1.0/api/testrepository/FP/folders/5/tests"

but got HTTP 500 error

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>500</status-code><message>Unrecognized field "tests" (Class com.xpandit.raven.rest.api.beans.CollectionBean), not marked as ignorable
 at [Source: org.apache.catalina.connector.CoyoteInputStream@240d5c9d; line: 1, column: 11] (through reference chain: com.xpandit.raven.rest.api.beans.CollectionBean["tests"])</message><stack-trace>org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "tests" (Class com.xpandit.raven.rest.api.beans.CollectionBean), not marked as ignorable
 at [Source: org.apache.catalina.connector.CoyoteInputStream@240d5c9d; line: 1, column: 11] (through reference chain: com.xpandit.raven.rest.api.beans.CollectionBean["tests"])
        at org.codehaus.jackson.map.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:53)
        at org.codehaus.jackson.map.deser.StdDeserializationContext.unknownFieldException(StdDeserializationContext.java:267)
        at org.codehaus.jackson.map.deser.std.StdDeserializer.reportUnknownProperty(StdDeserializer.java:673)
        at org.codehaus.jackson.map.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:659)
        at org.codehaus.jackson.map.deser.BeanDeserializer.handleUnknownProperty(BeanDeserializer.java:1365)
        at org.codehaus.jackson.map.deser.BeanDeserializer._handleUnknown(BeanDeserializer.java:725)
        at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:703)

I have already tried to send the data for the request in Base64 encoded as below, but still getting the same error

curl -i -H "Content-Type: application/json" -X PUT -u $jira_user:$jira_password --data 'eyJ0ZXN0cyI6W3sicmFuayI6IDEsImlkIjogMjk2MDAsImtleSI6ICJURVNULTEwMCIsInN1bW1hcnkiOiAiVGVzdCBTdW1tYXJ5IEhlYWRsaW5lIC0gVEVTVCAxMDAiLCJwcmlvcml0eSI6ICJMb3dlc3QiLCJhc3NpZ25lZSI6ICJVc2VyMTIzIiwid29ya2Zsb3dTdGF0dXMiOiAiQUNUSVZFIiwiY29tcG9uZW50cyI6IFtdLCJ0ZXN0VHlwZSI6IkN1Y3VtYmVyIn1dfQ==' "https://jiraserverhost.com/rest/raven/1.0/api/testrepository/FP/folders/5/tests"

How can I alter this? or
What changes do I need to do to make this request successful?

Upvotes: 0

Views: 215

Answers (1)

Cristiano Cunha
Cristiano Cunha

Reputation: 391

It seems by your question that you think that there is a relation between the organisation of tests in GitLab with the Test Repository in Jira (Xray), but they are independent. This means that the notion of Test Repository in Jira (Xray) is just a way to organise your tests, the way you have your tests in your source control repo is independent of this organisation.

You need to define (in your strategy) what is the master (source of changes where you will edit/create scenarios) if it is in Jira or in your source code, after that every time a change occur in your code you need to synchronise back those changes, looking at those too cases:

  • Master in Jira: Changes occur in Jira and then you need to push those changes to your source code via API.
  • Master in Source Control: Changes occur in code and then you have to push those changes to Jira via API.

Bear in mind that only the test specification is synchronised (not the test path or other aspects of it).

We have nevertheless a suggestion with that functionality already in our system, if you feel it is a change that will help you please upvote it here: https://jira.xpand-it.com/browse/XRAYCLOUD-3673.

Upvotes: 1

Related Questions