Custom field for test plan in jira xray - cucumber

I'm tring to import results to jira Xray using Rest API cucumber/mutipart with the following curl command :
curl -H "Authorization: Bearer $token" -F info=#Exec.json -F result=#file.json https://server/rest/raven/2.0/import/execution/cucumber/multipart
As this command creates a new test execution and we cannot report results to an existing one as bug mentionned https://jira.getxray.app/browse/XRAYCLOUD-2375
So I tried to add custom field related to test plan that already created
the problem that I cannot find the exact custom field's number I get always this error
{"error":"Error assembling issue data: Field \u0027customfield_11218\u0027 cannot be set. It is not on the appropriate screen, or unknown."
Here my Exec.json:
{
"fields": {
"project": {
"key": "project"
},
"summary": "Test Execution for cucumber Execution",
"issuetype": {
"name": "Test Execution"
},
"customfield_11218" : "ODI-1103"
}
}
I get the custom field for xml file exported from a test related to test plan:
<customfield id="customfield_11218" key="com.xpandit.plugins.xray:test-plans-associated-with-test-custom-field">
<customfieldname>Test Plans associated with a Test</customfieldname>
<customfieldvalues>
<customfieldvalue>[ODI-1103]</customfieldvalue>
</customfieldvalues>
</customfield>

In the case of Cucumber JSON reports, it's currently kind of an exception. If we want to link the results to a Test Plan, then we need to use the multipart endpoint that you mentioned.. which in turn always creates a new Test Execution.
The syntax for the JSON content used to customize the Test Execution fields should be something like:
{
"fields": {
"project": {
"key": "CALC"
},
"summary": "Test Execution for Cucumber execution",
"description": "This contains test automation results",
"fixVersions": [ {"name": "v1.0"}],
"customfield_11805": ["chrome"],
"customfield_11807": ["CALC-8895"]
}
}
(you can see a code example here; that repository contains examples in other languages)
In the previous example, the Test Plan custom field is "customfield_11807". Note that the value is not a string but an array of string of the issue keys of the connected Test Plans (usually just one).
From what you shares, it seems that you are referring to another custom field which has a similar name.
You should look for a custom field named "Test Plan" that has this description "Associate Test Plans with this Test Execution" (unless someone changed it).
To find the custom field id, you can ask your Jira admin to go to Custom Fields and then edit the field named "Test Plan"... Or you can also use Jira's REST API for that :)
https://yourjiraserver/rest/api/2/customFields?search=test%20plan
This will return a JSON content where you can see some custom fields, and you'll be able to depict the one you're looking for.

Related

How can I use the REST API to Remove Hold on a Bill?

I've created a bill using the REST API - but now I want to release it (which exists as an action) - but I'm assuming I have to remove the HOLD before I do that. I don't see that as an action. How would I go about doing that? And if this topic exists somewhere in the documentation, please let me know - I haven't been able to find anything.
Thanks...
You can extend the Bills endpoint and add action to it.
You need to add a new action to the Actions node of the Bills endpoint in the extended Web Service Endpoint like below
Then you can use that action like the below:
curl --request POST 'http://localhost/Acumatica/entity/DefaultExt/22.200.001/Bill/ReleaseFromHold'
--data-raw '{
"Entity": {
"Type": {"value":"Bill"},
"ReferenceNbr":{"value":"003238"}
}
}'
Since the hold status is still defined using the hold field, you can achieve that result by passing the false value to the Hold field.
{{BaseUrl}}/entity/default/22.200.001/Bill
{
"id": "589535fc-4a60-ed11-84a8-00e04cc71f57",
"Hold": {"value": false}
}

How to add file to the 'Evidance' using Cucumber JSON Multipart into the jenkinsci/xray-connector-plugin

I'd like to add file to the Evidence for new test execution.
How to upload file to the Evidance input using Cucumber JSON Multipart?
Xray plugin repo: jenkinsci/xray-connector-plugin
There is my multipart JSON:
{
"fields": {
"project": {
"key": "${projectKey}"
},
"summary": "Test Execution for Cucumber results (Generated by job: ${BUILD_TAG})",
"description": "Test Execution for Cucumber results (Generated by job: ${BUILD_TAG})",
"issuetype": {
"id": "12453"
}
},
"xrayFields": {
"testPlanKey": "${testPlanKey}",
"environments": [
"${env}"
]
}
}
What should I add to this json to upload a file into Evidence input?
That Cucumber JSON multipart endpoint (similarly with other endpoints) doesn't provide a way to specify that field explicitly.
The Xray JSON format (and either the standard or multipart endpoints) will allow you to specify that information; however, this format is not the most adequate one in case you want to upload Cucumber related results.
You have two options, since in this case I guess we can exclude using Xray JSON format:
a) use Cucumber JSON (either standard or multipart endpoint) and take advantage of the fact that Xray can process attachments (i.e. screenshots) that you can embed in the cucumber steps implementation (please see example on Xray docs where it briefly mentions it). You should look at cucumber's API to see how that can be done in terms of API.
As we speak, in Java, I think you have to do +something like this in a hook
scenario.attach(data, "image/png", "My screenshot");
Example here.
b) you can use your current approach and then use the GraphQL to update the evidence on the corresponding Test Run. This will be tricky to implement as you'll need to know the Test Execution issue key, then it's id and then use the proper GraphQL request to update evidence on a specific Test Run inside that Test Execution... this is not trivial though.

Luis List Entities and Synonyms

I'm attempting to use list entities for my chat bot when dealing with environments and am having trouble finding information on using synonyms.
Lets say I have a dev, test, and prod environment. I want these environments limited to the normalized list items but I also want production to be a synonym for 'prod'. I would expect when a user asks 'Perform action x on production' that the 'environment' entity would be 'prod' because production is a synonym for prod. This is not the case though and the entity returns as 'production' instead. Perhaps I'm misunderstanding the purpose of the synonyms?
Link to screenshot: https://i.stack.imgur.com/PoPAv.png
You are proceeding almost correct. There is slight confusion while using "Test panel" inside LUIS.ai UI.
You have two options to get what you want.
1) While inspecting result in "Test panel" click "Compare with published" and then click at "Show JSON view" and you'll something like:
See https://learn.microsoft.com/en-us/azure/cognitive-services/luis/luis-interactive-test for more details.
2) use http GET towards REST API in your browser as an alternative:
https://yourLocaltion.api.cognitive.microsoft.com/luis/v2.0/apps/youAppId?subscription-key=yourSubscirptionId&q=lock%20development
The results in your case should be:
{
"query": "lock development",
"topScoringIntent": { ...
},
"entities": [
{
"entity": "development",
"type": "Environment",
"startIndex": 5,
"endIndex": 15,
"resolution": {
"values": [
"Dev"
]
...
See section "Manage" > "Keys and Endpoints" in your LUIS app administration to get details about correct url for using REST API.

XPages Extlib REST update (HTTP PUT) on calendar event is returning error code (cserror : 1028)

I am trying to update a calendar event in Domino Mail Calendar by using the REST data service "calendar" from the latest xpages extlib release "ExtensionLibraryOpenNTF-901v00_13.20150611-0803".
Has anybody done this with a successful return?
Unfortunately I haven't had any success trying to update a calendar event. I was successful getting the list of events, creating events, deleting an event, but to update an event seems to be somehow special. The PDF documentation for the calendar service is quite short on this point. My domino server is accepting all protocols including PUT. I am using the JSON format for my REST calls. The UPDATE I tried as described in the documentation with iCAL as well, but getting the same error.
I am using the Firefox REST Plugin for checking out the service, before I am implementing it.
Im using PUT, with content-type "text/calendar" as well "application/json".
My URL:
http://sitlap55.xyzgmbh.de:8080/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D
My Body looks like this, which is the easiest event type, a reminder (but I tried it with meeting and appointment as well):
{"events":[{"UID:"4D750E2B8159D254C1257E9C0066D48D","summary":"Ein Reminder update","start":{"date":"2015-08-13","time":"13:00:00","utc":true}}]}
This is how I return the event by a GET:
{
"href": "/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated",
"id": "4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated",
"summary": "Ein Reminder",
"start": {
"date": "2015-08-12",
"time": "07:00:00",
"utc": true
},
"class": "public",
"transparency": "transparent",
"sequence": 0,
"x-lotus-summarydataonly": {
"data": "TRUE"
},
"x-lotus-appttype": {
"data": "4"
}
}
This is the error I get:
{
"code": 400,
"text": "Bad Request",
"cserror": 1028,
"message": "Error updating event",
"type": "text",
"data": "com.ibm.domino.calendar.store.StoreException: Error updating event\r\n\tat com.ibm.domino.calendar.dbstore.NotesCalendarStore.updateEvent(NotesCalendarStore.java:229)\r\n\tat ... 65 more\r\n"
}
The attributes in the body I tried a lot of different things, using the id, no id, an UID like in the calendar service doumentation, ...
What am I doing wrong here?
The solution:
Using the PUT method, the URL which worked looks like this:
http://sitlap55.xyzgmbh.de:8080/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated
the BODY looks like this:
{"events":[{"id":"4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated","summary":"Some Reminder update #6","start":{"date":"2015-08-13","time":"10:00:00","utc":true}}]}
What I figured out was, that the "id" attribute is required ! a bit strange, because it is already in the URL.
I just checked against the documentation for Domino Access Services (DAS) 9.0.1 - and the example they have there actually works.
I tried a few things before that, e.g. if I could PATCH (change individual fields) or PUT (change ALL fields) just specifying the non-system fields. None of these worked. But taking the response from creating (or getting) the event and put it into a PUT request and adjust e.g. start time works fine.
Looking at your example I think the issue is similar as you do not include the end time in the request. But even so you seem to have to include the entire record as it is returned from the service - and please note that the url must end on the ENTIRE id (i.e. including "...-Lotus_Auto_Generated") :-)
/John
Edit:
It seems you don't need to add all fields... But be aware of the side effects of not specifying fields... You need to test it for yourself!

Is there any way to retrieve the name for a gist that github displays

When I browse to a gist on gist.github.com it displays a friendly name. E.g. for
https://gist.github.com/stuartleeks/1f4e07546db69b15ade2 it shows stuartleeks/baz
This seems to be determined by the first file that it shows in the list of files for the gist, but I was wondering whether there is any way to retrieve this via the API?
Not directly, but you can get with the Gist API the JSON information associated to a gist, reusing the id of your url:
GET /gists/:id
In your case: https://api.github.com/gists/1f4e07546db69b15ade2
It includes:
"files": {
"baz": {
"filename": "baz",
and:
"owner": {
"login": "stuartleeks",
That should be enough to infer the name stuartleeks/baz.

Resources