Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

[RPE] How to get an attached image (not attachment) from RQM's script step.

Morning,

Im trying to obtain and image inserted in a step text field in RQM 4.0.1 through RPE.

I can get attachments but not an image directly inserted in a text field using "Insert Image" button.

I can get attachments through tesscript data  source schema cause it has Attachment field:

But, is there any way to get attached images, for example an image attached in expectedResult field ???

I can see that image attached in expectedResult field is in feed code:

<ns9:expectedResult xmlns:ns9="http://jazz.net/xmlns/alm/qm/v0.1/testscript/v0.1/"><div:div xmlns="http://www.w3.org/1999/xhtml" xmlns:div="http://www.w3.org/1999/xhtml">
	Se accede correctamente 
<ns20:a xmlns="" xmlns:ns20="http://www.w3.org/1999/xhtml" href="https://myserver:9443/jazz/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/_NrEm0SdgEeO3UKXOjinjcw" target="_blank"><ns20:img xmlns:ns20="http://www.w3.org/1999/xhtml" src="https://myserver:9443/jazz/service/com.ibm.rqm.planning.service.internal.rest.IAttachmentRestService/_NrEm0SdgEeO3UKXOjinjcw" alt="RQM_31.png" height="24" style="width: 24px; height: 24px;" width="24"></ns20:img></ns20:a>
</div:div></ns9:expectedResult>
But cant assign to an IMAGE component of RPE:

Thank you very much!

0 votes


Accepted answer

Permanent link
Images embedded in the rich text (XHTML) content in the Description/Expected Result fields of a test script step are not reportable.  However, the entire rich text (XHTML) content in the Description/Expected Result fields is reportable.
Alvaro Riera selected this answer as the correct answer

1 vote

Comments

tyvm 

Does this mean that if the entire rich text content in the Description/Expected Result fields is published, the embedded image is published too? 

The RQM Reportable REST API will expose the XHTML content from these sections.  This XHTML content may contain embedded images, which are embedded via image links (not reportable) or a base64 string (reportable).


One other answer

Permanent link

 Hola Alvaro


I have accomplished what you are asking. I have separte the Text and the Image from the "Expected Result"/"Step Description".

I used this code to create an HTML tag : 

var ini = expectedResult.indexOf("<img");

if (ini == -1){
var str1  =  "<div>NA</div>";
str1;
}
else {

var str1 = "<div><p style=\"text-align: center;\" dir=\"ltr\" >"
var str2 = "</p></div>"
var fin = expectedResult.indexOf("/>",ini);
var img_str_0 = expectedResult.substring(ini,fin+2);
var temp1 = img_str_0.indexOf("src=\"https");
var img_sin_tilde = img_str_0.split("%E1").join("á");
img_sin_tilde = img_sin_tilde.split("%C1").join("Á");
img_sin_tilde = img_sin_tilde.split("%E9").join("é");
img_sin_tilde = img_sin_tilde.split("%C9").join("É");
img_sin_tilde = img_sin_tilde.split("%ED").join("í");
img_sin_tilde = img_sin_tilde.split("%CD").join("Í");
img_sin_tilde = img_sin_tilde.split("%F3").join("ó");
img_sin_tilde = img_sin_tilde.split("%D3").join("Ó");
img_sin_tilde = img_sin_tilde.split("%FA").join("ú");
img_sin_tilde = img_sin_tilde.split("%DA").join("Ú");

var img_str_1 = img_sin_tilde;

if (temp1 == -1){
var img_str=img_str_1.replace("src=\"","src=\"https://yourserverurl:9443");
} else{
var img_str=img_str_1;
}
str1.concat(img_str,str2);
}

*This code is only for 1 image.  If the step have more than 1 image I used other code in other cells.

With this I also exported to excel and imported using RQM importer.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019
× 332
× 230

Question asked: Sep 30 '13, 2:09 a.m.

Question was seen: 14,002 times

Last updated: May 15 '19, 1:02 p.m.

Confirmation Cancel Confirm