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

How to add new attachments, as log files to the test case execution result using RQM JUnitSelenium Adapter

Hi,

I am trying to upload a log file to RQM test case execution record, during my automation process.
I am using RQM JUnitSelenium Adapter to make the Appium integration with Rational Quality Manager. I already got to attach all screenshots using the path content in this variable System.getProperty("selenium.screenshot.dir").

We trying to figure out how to work through those links below, but without success:

https://www.ibm.com/support/knowledgecenter/SSYMRC_5.0.2/com.ibm.rational.test.qm.doc/topics/t_add_cmd_line_attachments.html

https://jazz.net/forum/questions/81549/how-to-attach-external-execution-result-files-in-rqm-result-log

Which or Where I have to edit to set the Log file path?

Thanks for the help.

Malliens


0 votes



5 answers

Permanent link

@Subhajit Bhuiya or @Abhishek Gour,

I have talked with @Ricardo Souza about this issue. It seems they do understand the instructions from the links provided about how to add attachments to the execution result, however, they would like to obtain a more explicit answer:

The problem they have is this: 

System.getProperty("com.ibm.rqm.adapter.resultAttachmentsFile") - They got the path value, they don't know if have a file inside, in a case that they check and there is file, they have to update that file?

System.getProperty("qm_AttachmentsFile") - This they couldn't got any value

So, they would like to make sure they have the right environment variable that actually points to the right temporary file. Is there a way for them to actually verify this in the machine where the script is going to be executed?



<style type="text/css"> body { margin: 0 0 0 0; padding:0 0 0 0 } td,div { font-family:Arial;font-size:8pt;vertical-align:top } / Copyright IBM Corp. 2016 All Rights Reserved. / body { margin: 0 0 0 0; padding:0 0 0 0; overflow:hidden; background-color:#fafafa; } .grayBackground { background-color:#f6f6f6; } .transcript { background-color:#d2d2d2;} .messageBlock {padding-left:10px; padding-right:10px;padding-top:0} .expansion{height:10px;width:100%;overflow:hidden;} .expansionx{height:10px;overflow:hidden;} .line{height:1px;background-color:#cccccc;overflow:hidden;} .message { padding-left:0px; padding-right:65px;margin-left:0px; word-wrap:break-word; white-space:-moz-pre-wrap; _white-space:pre; white-space:pre-wrap; } .messageCont { padding-left:0px; margin-left:95px; word-wrap:break-word; white-space:-moz-pre-wrap; _white-space:pre;white-space:pre-wrap;} .other { font-size:11px;color:#1970b0;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; white-space:nowrap; padding-top:2px; } .myself { font-size:11px;color:#222222;font-style:normal;font-weight:bold;font-style:normal;float:left; width:95px; white-space:nowrap; padding-top:2px; } .otherCont { font-size:8px;text-align:right; color:#1970b0;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .myselfCont { font-size:8px;text-align:right; color:#222222;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .system { font-size:11px; word-wrap:break-word;color:#d13f08;font-style:normal;font-weight:normal; white-space:-moz-pre-wrap; _white-space:pre;white-space:pre-wrap; } .showTimestamp { padding-left:20px;font-size:11px; float:right; color:#999999;font-style:normal;font-weight:normal; } .other1 { font-size:11px; color:#ba006e;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; padding-top:2px; } .otherCont1 { font-size:8px;text-align:right; color:#ba006e;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other2 { font-size:11px; color:#007670;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; padding-top:2px; } .otherCont2 { font-size:8px;text-align:right; color:#007670;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other3 { font-size:11px; color:#3b0256;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; padding-top:2px; } .otherCont3 { font-size:8px;text-align:right; color:#3b0256;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other4 { font-size:11px; color:#00512b;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; padding-top:2px; } .otherCont4 { font-size:8px;text-align:right; color:#00512b;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other5 { font-size:11px; color:#a91024;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; padding-top:2px;} .otherCont5 { font-size:8px;text-align:right; color:#a91024;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other6 { font-size:11px; color:#b8471b;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; padding-top:2px;} .otherCont6 { font-size:8px;text-align:right; color:#b8471b;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .other7 { font-size:11px; color:#7f1c7d;vertical-align:top;font-weight:bold;font-style:normal;float:left; width:95px; padding-top:2px;} .otherCont7 { font-size:8px;text-align:right; color:#7f1c7d;font-family:Arial,Lucida Grande;font-style:normal;vertical-align:top;font-weight:bold;float:left; width:95px; } .highlight { background-color:#bed6f8; } .datestamp { padding-right:0px; font-size:11px; cursor:default;padding-top:1px;padding-bottom:1px; background-color:#a7a7a7; width:100%; float:left; text-align:right; color:#333333; font-weight:bold; font-style:italic; } #chatAlert { float:left; border-bottom:1px solid #E8D091; padding:6px; width:100%; color:#A5754C; } #chatAlertImage { float:left; } #chatAlertText { float:left; margin-left:6px; margin-right:10px;} #chatAlertClose { float:right; margin-right:10px; padding-right:6px; margin-top:0px; } #chatAlertText a { color:#A5754C; } #chatAlertText a:hover { color:#A5754C; text-decoration:none; } .tsDisplay { display:block }.dsDisplay { display:none } </style>






2:15:12 PM

0 votes


Permanent link

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

0 votes


Permanent link

Good Afternoon,

I follow the instructions, but it still not working. Maybe I had done something wrong.

Just to check here are the files:

Arquivolog.log - That's the file that I want to send attach to the RQM execution. content below




2017.03.28.09.00.36: Arquivo gerado com sucesso: C:\Temp\RQMJUnitSeleniumAdapter\Appium_test_results\2017.03.28\APJ_ANDROID\COMPLETA\XML\2017.03.28.09.00.36_evidencias.xml
2017.03.28.09.00.37: ---------------------------------------------
2017.03.28.09.00.37: teste: testCase_SobreVersaoApp - Iniciado
2017.03.28.09.00.37: Aqui vem o nome do metodo: testCase_SobreVersaoApp
2017.03.28.09.07.54: Arquivo gerado com sucesso: C:\Temp\RQMJUnitSeleniumAdapter\Appium_test_results\2017.03.28\APJ_ANDROID\COMPLETA\XML\2017.03.28.09.07.54_evidencias.xml
2017.03.28.09.07.54: ---------------------------------------------
2017.03.28.09.07.54: teste: testCase_SobreVersaoApp - Iniciado
2017.03.28.09.07.54: verificar: area nao logada - pagina de login
2017.03.28.09.07.54: clicar: botao-sobre
2017.03.28.09.08.02: status: objeto versao-app encontrado!
2017.03.28.09.08.05: Versão 3.2.2
2017.03.28.09.08.12: clicar: icone-bb
2017.03.28.09.08.13: Não existe nenhum erro registrado
2017.03.28.09.08.16: status: objeto mensagem-centralizador encontrado!
2017.03.28.09.08.19: clicar: botao-OK
2017.03.28.09.08.28: clicar: botao-voltar-app
2017.03.28.09.08.37: Arquivo gerado com sucesso: C:\Temp\RQMJUnitSeleniumAdapter\Appium_test_results\2017.03.28\APJ_ANDROID\COMPLETA\XML\2017.03.28.09.07.54_evidencias.xml
2017.03.28.09.08.37: teste: testCase_SobreVersaoApp finalizado com Sucesso
2017.03.28.09.08.37: ---------------------------------------------



attchmentInfoFile.txt -  content below



myFile1=c:\Temp\arquivoLog.log





0 votes


Permanent link

selenium.properties - file with adapter properties - content below, without the comments





com.ibm.rqm.selenium.seleniumClasspath=C:\Temp\MovAppiumTests.jar;C:\Temp\libs\appium\commons-lang-2.6.jar;C:\Temp\libs\appium\jcifs-1.3.3.jar;C:\Temp\libs\appium\commons-codec-1.10.jar;C:\Temp\libs\appium\commons-exec-1.3.jar;C:\Temp\libs\appium\commons-io-2.5.jar;C:\Temp\libs\appium\commons-lang3-3.4.jar;C:\Temp\libs\appium\commons-logging-1.2.jar;C:\Temp\libs\appium\gson-2.3.1.jar;C:\Temp\libs\appium\guava-19.0.jar;C:\Temp\libs\appium\hamcrest-core-1.3.jar;C:\Temp\libs\appium\hamcrest-library-1.3.jar;C:\Temp\libs\appium\htmlunit-driver-2.21.jar;C:\Temp\libs\appium\httpclient-4.5.2.jar;C:\Temp\libs\appium\httpcore-4.4.4.jar;C:\Temp\libs\appium\httpmime-4.5.2.jar;C:\Temp\libs\appium\java-client-3.4.1.jar;C:\Temp\libs\appium\jna-4.1.0.jar;C:\Temp\libs\appium\jna-platform-4.1.0.jar;C:\Temp\libs\appium\junit-4.12.jar;C:\Temp\libs\appium\selenium-api-2.53.1.jar;C:\Temp\libs\appium\selenium-java-2.53.1.jar;C:\Temp\libs\appium\selenium-leg-rc-2.53.1.jar;C:\Temp\libs\appium\selenium-remote-driver-2.53.1.jar;C:\Temp\libs\appium\selenium-support-2.53.1.jar;


com.ibm.rqm.commandline.systemproperties=false


com.ibm.rqm.commandline.executionproperties=CREATE

com.ibm.rqm.adapter.resultAttachmentsFile.maxfilesize=50
com.ibm.rqm.adapter.resultAttachmentsFile=C:\Temp\attachmentInfoFile.txt


0 votes


Permanent link

 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.

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
× 6,121
× 1,381

Question asked: Apr 10 '17, 2:45 p.m.

Question was seen: 4,602 times

Last updated: Sep 29 '17, 9:54 a.m.

Confirmation Cancel Confirm