It's all about the answers!

Ask a question

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

Alvaro Riera (401916) | asked Sep 30 '13, 2:09 a.m.
edited Sep 30 '13, 3:39 a.m.


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=""><div:div xmlns="" xmlns:div="">
	Se accede correctamente 
<ns20:a xmlns="" xmlns:ns20="" href="https://myserver:9443/jazz/service/" target="_blank"><ns20:img xmlns:ns20="" src="https://myserver:9443/jazz/service/" alt="RQM_31.png" height="24" style="width: 24px; height: 24px;" width="24"></ns20:img></ns20:a>
But cant assign to an IMAGE component of RPE:

Thank you very much!

Accepted answer

permanent link
Paul Slauenwhite (8.3k12) | answered Sep 30 '13, 9:31 a.m.
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

Alvaro Riera commented Oct 01 '13, 2:49 a.m.


Bob 3 commented May 15, 12:58 p.m.

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

Paul Slauenwhite commented May 15, 1:02 p.m.

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
Cesar Sasaki (51116296) | answered Feb 21 '17, 12:22 p.m.

 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>";
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;

*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.

Your answer

Register or to post your answer.