How to add new attachments, as log files to the test case execution result using RQM JUnitSelenium Adapter
Ricardo Souza (17●2●10)
| asked Apr 10 '17, 2:45 p.m.
retagged May 16 '17, 2:58 a.m. by Minakshi Jaint (511●3) Hi,
|
5 answers
@Subhajit Bhuiya or @Abhishek Gour,
|
Hi Ricardo,
The steps given for command line adapter can be used for Junit Selenium adapter as well with a little difference that now, the attachment variable updation has to happen via Junit Scripts.
Let me put all the steps in detail for you. Before that it is important to understand that we simply need a attachmentInfoFile which is actually referred as "resultAttachmentsFile" in adapter context. This attachmentInfoFile is the placeholder for key value pair of <file heading>=<attachment file path>.
for example you can decide a file name with "C:\tmp\attachmentInfoFile.txt". The content of the file could be -
"myLink=http://www.ibm.com"
"myFile=C:\tmp\temp.txt" etc.
Here are detailed steps -
1. Update the selenium.properties file with a value for "com.ibm.rqm.adapter.resultAttachmentsFile". The path should be the file which represent attachmentInfoFile. Add following line in selenium.properties file -
com.ibm.rqm.adapter.resultAttachmentsFile=C:\tmp\attachmentInfoFile.txt.
Restart the Adapter after this change.
2. Now the file which keep all the attachment info is set in adapter. This file can be read at any given point of time ( manually or via scripts ).
Please note that the content of this file should be dynamic. The attachments may differ from one test run to another test run.
For this reason the content of this file is always cleaned before starting a new execution.
After this file is cleaned by adapter, it is your selenium script which should open this file, update the key-value pair for your required attachment info, and close the file, as and when required in your selenium execution.
So you can choose to add code similar to following snippet in your selenium script -
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #3933ff} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; color: #4e9072} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco} span.s1 {color: #000000} span.s2 {color: #7e504f} span.s3 {color: #931a68} span.s4 {color: #3933ff} span.Apple-tab-span {white-space:pre}
</style>
String attachmentsPathFile = "c:\tmp\attachmentInfoFile.txt"; FileOutputStream fos = new FileOutputStream(attachmentsPathFile); String filePath1 = "myFile1=c:\tmp\file1.txt"; fos.write(filePath1.getBytes("UTF-8")); String linkPath1 = "myFile1=http://www.ibm.com"; fos.write(linkPath1.getBytes("UTF-8")); fos.close(); This is run time updating of the attachment file info. When your execution would be over, the attachmentFileInfo would be read by the adapter and the attachments would be created for the result based on these key-value pairs present in attachmentInfoFile.
I hope these steps solves your problem. In case you need any other info, please respond to this chain.
Thanks, Abhishek |
Good Afternoon,
|
selenium.properties - file with adapter properties - content below, without the comments
|
Hi Ricardo Souza,
Just curious to know if you happen to solve your problem.
Just in case it is not solved, please note that - in your case - "attchmentInfoFile.txt" is created by adapter. Then your JUNIT Script should open this file and write the path of the attachment ("myFile1=c:\Temp\arquivoLog.log") around initial part of your Junit Execution. Then after Junit Execution exits, Adapter simply try to read "attachmentInfoFile.txt" - find myFile's value ( name of the attachment file ) and add that as part of attachment to the result.
The code snippet given in the one of my previous answer would create this file by your Junit Script.
Thanks,
Abhishek.
|
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.