Where do you find the attachments loaded by a tester in the guided test execution screen?

VJ20
Kilo Contributor

If a tester uses the guided execution and uploads an attachment, where can we see the attachment? It is not in the test plan.

I don't see it in Metric Results either.

1 ACCEPTED SOLUTION

ITSMgal
ServiceNow Employee
ServiceNow Employee

Hi Vanessa -



I was testing this a few weeks back and noticed the same thing you came across.


Through the Helsinki release, the attachments are not being copied over on submission or save of the test.



When i asked for a recommendation on how to access the attachments,   it was to use the record based view of test executions instead of the assessment/survey "Guided Test" method. This way the tester could attach to the correct record.



While this may work in some cases, it may not be the ideal solution.



The alternative is a code based (partial) solution for this issue. I used this in a demonstration, but its NOT PRODUCTION CODE 🙂



Here is the catch - this code copies the attachment to all of the test execution steps.


This can be good and bad -


Good: the attachment will be available from the step it failed


Bad: Irrelevant attachments will exist on execution steps.


This alludes to what Chuck Tomasi@   was saying re: the target record.



If we only copy the attachment to the test case, then its not as easily available on the execution step.


The challenge here is which record it should equate to in the test execution. There is currently only one "attachment" for the entire test execution, so when someone goes to view the execution step, where should the attachment really be?



It would be interesting to get your feedback on this. I would appreciate if you could open up a ticket with ServiceNow support on this issue to explain what the problem is. https://hi.service-now.com This will find its way to the Product Backlog through our Service Management process. Feel free to post the ticket number here so i can track it.



Regarding the code to copy the attachment:




We sync up test results from assessments to test plan through the SCRIPT INCLUDE tm_AssessmentResultSync.


In that there is a method syncResults



In that around line 26 you will find code like this



if( testCaseMetric.isValid() ) {


                              this.updateResult(testCase, testCaseMetric, asmtInstance);


GlideSysAttachment.copy(tm_TestManagement.ASMT_INSTANCE, asmtInstanceDecorator.getValue('sys_id'), tm_TestManagement.TEST_CASE_INSTANCE, testCase.getValue('sys_id'));


}



Add the line in Green there and it will copy attachments from assessment to test cases.



One thing to note, if testers takes test cases through assessment multiple times, attachments will get copied multiple times.


So may be you need to add a logic to delete attachments and copy again.



NOTE: Please do not add this directly in production. It was code used for demonstration purposes only. It needs fully tested against your use case.


View solution in original post

15 REPLIES 15

smicloud
Giga Guru

When I tried this I got multiple instances of the same file attached to the test case instance. I did some tweeking to see if I could just get rid of the duplicates. Adding some code to Emily's solution gives this, around row 26   (I haven't tested this thoroughly so be careful to test it properly before using it in production):



  var attachments = new GlideRecord('sys_attachment');


  attachments.addQuery('table_sys_id', testCase.getValue('sys_id'));


  attachments.query();


  if(attachments.getRowCount() < 1){


      GlideSysAttachment.copy(tm_TestManagement.ASMT_INSTANCE, asmtInstanceDecorator.getValue('sys_id'), tm_TestManagement.TEST_CASE_INSTANCE, testCase.getValue('sys_id'));


  }



This will of course not work if you have use cases where you add files to the test case before notifying users to start testing. This will only be a valid solution if the only attachments to add to the test case instances will be added upon users submit of the test result.