It's all about the answers!

Ask a question

Uploading Attachments for RQM Automation Result through OSLC

Elliot Morrison-Reed (2059) | asked Dec 04 '13, 9:58 a.m.

I have written a few questions along my journey creating an RQM Automation Adapter from scratch. I have finally created an adapter that is able to handle Automation Requests and post the result back to the system.  I now have to attach the actual test system results to the object as explained in Step 30 in the API Reference.

The uploadAttachmentUrl property is clearly there in the Automation Request object.  If I run a GET request on the URI, I receive a list of attachments in the system:
<?xml version="1.0" encoding="UTF-8"?>
    <title type="text">attachment ATOM feed for project area ...</title>
<link href="https://server:9443/qm/web/console/" rel="alternate"/>
<link rel="self" href="https://server:9443/qm/service/"/>
<title type="text">SW-List.csv</title>
<summary type="text">Attachments Section</summary>
<link href="" rel="alternate" type="application/xml" title=""/>
I can also send a POST request to the address with a multipart/form-data request with my file included.

  Content-Type: multipart/form-data
  Accept: */*

Content-Disposition: form-data; name="test_result_report.txt"; filename="test_result_report.txt"
Content-Type: application/octet-stream; name="test_result_report.txt"

<... file-data ...>

This appears to work at first glance:  I receive a 201: Created HTTP response with a 'location' header ('https://server:9443/qm/service/').  However, the new attachment does not appear in the list of attachments if I run another GET on the base address.

I thought that perhaps it is a special class of attachment that wouldn't show up in the base query, so I have tried adding an rqm_auto:attachment triple to the URI provided by the in the location header anyways.  This does not cause an error in the Automation Result Creation Factory POST, but when I run a GET on the created Automation Result, there is no attachment property included.

There are no 3xx or 4xx Responses in the entire sequence, however the attachment does not end up in the attachment list or in the desired Automation Result.

How can I get my test results attached to the final Automation Result Resource?


Accepted answer

permanent link
Paul Slauenwhite (8.4k12) | answered Dec 05 '13, 9:20 a.m.
Hi Elliot,

It appears the attachment is not being created correctly.  You need to following the conditions in
Elliot Morrison-Reed selected this answer as the correct answer

Elliot Morrison-Reed commented Dec 09 '13, 10:32 a.m.

Hi Paul,

I was able to figure it out eventually.  Seems like it had to do with tagging the Content-Transfer-Encoding in the request body as "binary". Now I can see the attachment tag is saved in the OSLC representation, and I can access the attachment through the OSLC resources link.  However, I can't find any mention of the attachment in the web interface.  It seems like all the other pieces of information (verdict, startTime, endTime, other links, etc.) are there, but not attachment.  Any idea where I should look for it?


Paul Slauenwhite commented Dec 09 '13, 1:52 p.m.

Hi Elliot,

Attachments are not exposed in the Request and Execution Result editors.

Elliot Morrison-Reed commented Dec 10 '13, 9:04 a.m.

Is this by design? How is the end user supposed to access the results of the test?

2 other answers

permanent link
Vaibhav Srivastava (2861) | answered May 20 '14, 4:52 a.m.
 Hi Elliot,
By any chance have you looked at how the Eclipse Lyo sample adapter works to upload the attachments?

The sample adapter runs a test and at the end uploads a sample file to the result. This sample file is visible in the RQM's result UI. Here is a UI screenshot on how the attachment appears here
In eclipse Lyo sample, look for the comment 
// Upload an attachment for the result in

Hope this helps

permanent link
Paul Slauenwhite (8.4k12) | answered Dec 10 '13, 9:15 a.m.
Not all OSLC properties are exposed in the RQM UI since OSLC is an open standard that defines resources and their properties that are not required/supported by RQM. 

Your answer

Register or to post your answer.