10-21-2015 02:22 PM
Hi everyone,
I have a "statement" step (Step 1) inside a while loop which creates an additional result for the step (using Step.AdditionalResults.CustomResults.Insert). For each loop of the While Loop this "statement" step will create a new additional result. After Step 1, I want to delete the additional result created for Step 1. If I don't delete it, after every loop my report file will include all the previous loop additional results.
Is there a way to delete the additional result created for Step 1?
Thanks so much!
Solved! Go to Solution.
10-21-2015 04:41 PM
I'm trying to picture this. So basically you only want the last time the loop executes to record the additional result?
Why couldn't you just have a dummy step after the loop that records the last value?
10-21-2015 05:13 PM
I have an "array of test names" stored as a local within Test Stand. I also have an "array of boolean data (P/F)" stored as a local associated with each index of the "array of test names." I want to create an additional result for each test name along with it's corresponding boolean data. By creating an additional result for each I can make sure the data is included within the Test Report.
If the "array of test names" was static I could just hardcode each test name as multiple additional results within the "statement" step. However, the test names can be variable within the "array of test names" depending on the product being tested.
The first loop of the whle loop will create an additional result for the "statement" step (done programattically using Step.AdditionalResult.CustomResults.Insert). The first loop sends to the Test Report "Test Name 1, Data 1." Upon the second loop, the "statement" step will create another Additional Result for "Test Name 2, Data 2." The second loop sends to the Test Report both the Test Data 1 information and Test Data 2 information. It sends Test Data 1 because it was never deleted.
The test report would look like this:
After First Loop Statement:
Test Name 1, Data 1
After Second Loop Statement:
Test Name 1, Data 1
Test Name 2, Data 2
After Third Loop Statement:
Test Name 1, Data 1
Test Name 2, Data 2
Test Name 3, Data 3
If the array index was 3, then the while loop would run 3 times. The test report would look like this if the additional result was not deleted everytime the "statement" step ran.
Test Report:
Test Name 1, Data 1
Test Name 1, Data 1
Test Name 2, Data 2
Test Name 1, Data 1
Test Name 2, Data 2
Test Name 3, Data 3
But what I really want the Test Report to look like is (if the additional result was deleted after every time the "statement" step ran):
Test Report:
Test Name 1, Data 1
Test Name 2, Data 2
Test Name 3, Data 3
Here's the sequence snapshot:
Thanks for your help.
10-22-2015 08:33 AM
Consider the attached sequence file. Why wouldn't you just use the same result? Why do you need to insert and delete it each time?
Can you send me that sequence you sent the screenshot of? That way I can get a better feel for what you are doing.
10-22-2015 11:32 AM
Thanks Jigg. Your example gave me an idea on how to resolve my issue. I am handling the Additional Results now within based on the loop count instead of creating a new additional result programmatically.This fixes my problem and now everytime the first statement is run it will dynamically insert the index of the correct Test Name and corresponding Boolean Data for that Test Name and then send that to the Test Report.
I have attached my code.
10-22-2015 03:36 PM
Glad to hear it is working. I guess I don't need your code if that is the case... 🙂
Cheers,