NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Remove Entire Sequence from xml using stylesheet

Solved!
Go to solution

I have just starting developing with TestStand and its XML report generating functionality and have managed to jump most learning hurdles thusfar except for this one:

 

I want to be able to remove an entire sequence (and all sub-actions/sequences under it).  I have successfully created filtering expressions in a customized report.xsl to remove 'failed' tests from a specific steptype.  However, removing ALL steps/actions that belong to a parent sequence has stumped me.

 

To illustrate better, say I have 3 sequences in my mainsequence file called "Group A", "Group B", Group C".  I will have three different stylesheets that will filter one of these three groups.

 

If the raw (unfiltered) output looks like this:

 

Group A

-Begin sequence Group A

-Step 1

-Step 2

-Subsequence A1

--Step 1

 

Group B

-Begin sequence Group B

-Step 1

-Step 2

-Subsequence B1

--Step 1

 

Group C

-Begin sequence Group C

-Step 1

-Step 2

-Subsequence C1

--Step 1

 

I would like to be able to filter the xml so that it removes Group B entirely, like so:

 

Group A

-Begin sequence Group A

-Step 1

-Step 2

-Subsequence A1

--Step 1

 

Group C

-Begin sequence Group C

-Step 1

-Step 2

-Subsequence C1

--Step 1

 

I am extremely new to XML and XSL stylesheets and how they interact with TestStand.  Is what I am trying to do possible?  As a fallback, I guess I could somehow tag every action in a sequence with the group it executes under -- possibly by using a string in "additional results", but this would be very timeconsuming and prone to error.

 

Any guidance is very appreciated.

 

Thank you for your time,

Matt

 

0 Kudos
Message 1 of 4
(3,919 Views)

Do you need the data in your xml file?  If not then the best way to accomplish this is just remove it from the resultlist before you ever generate the report.  This can be done in a multitude of places: Cleanup, PostStepResultListEntry Callback, process model, etc...  Pick your poison.

If you need it in the XML file then you are correct in assuming that you need to modify the style sheet.  NI does not support modifications of the stylesheets. for obvioius reasons.  I'm not aware of an immediate solution to your problem either.  However, here is the best xsl tutorial I have found when I've had to edit the style sheets: http://www.w3schools.com/xsl/default.asp

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 4
(3,859 Views)

Unfortunately, I do need the data in my XML file.  The XML file output from teststand contains a superset of the data I need.  As mentioned in the OP, I will need some stylesheets that only output Group A and C, while another needs Group A and B, and, unfortunately, the test is too long to run multiple tests with slightly modified outputs on each.

 

I may have to add an "additional result" to every action/sub-sequence in the group so that I can filter based on the node's properties, instead of the parent sequence's properties (which is the original hurdle).

 

With that being said, I've also had a hard time figuring out how exactly to address the "additional results" data structure while modifying the "CheckIfStepSatisfiesFilteringCondition_node()" function.  Once I can access the Additional Results structure, I maybe able to figure out how to find a specific string that I can filter on.

 

Thanks for your reply, ~jiggawax~

0 Kudos
Message 3 of 4
(3,856 Views)
Solution
Accepted by MatthewHaentschke

SOLVED!

 

Turns out, the answer wasn't as difficult as I thought.  The action for removing an entire sequence is actually not very different from remvoing a single "failed" step or "NI_FLOW" steptype.

 

The code snippet for the solution is shown below and can be merged with whatever currently exists in your .xsl stylesheet:

 

function CheckIfStepSatisfiesFilteringCondition_node(node)
	{
	   //ADD_STEP_FILTERING_CONDITION	
	   //Modify the filtering condition here to filter steps shown the report.
	
	   //Grab the displayed step name
             var stepName = node.selectSingleNode("Prop[@Name = 'TS']/Prop[@Name = 'StepName']/Value").text;

             //Test if step name corresponds to sequence desired for removal ("Group B" in this example)
             if (stepName=='Group B')
               return false;
	   return true;
	 }    

 

 

If a step name ever matches "Group B", not only is that report line removed, but ALL steps under this parent are also removed.  This is exactly what I was describing in the OP.

 

0 Kudos
Message 4 of 4
(3,847 Views)