From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

change the step name dynamically

Solved!
Go to solution

Hi

I'm trying to find out how to change the step name.

The problem is: When I call a sequence several times, I can find the names of the steps in the report for about 50 times.

So, what I want to do is: I want to pass a prefix for the step name on calling the sequence and add this prefix to each step name.

Do you have an idea how to do that?

Thanks a lot

Meike

0 Kudos
Message 1 of 9
(9,736 Views)

Hi Meike,

 

Just rename in PreExpression of the Step with Step.Name = "HelloWorld"

 

Hope this helps

 

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
Message 2 of 9
(9,732 Views)

Hi Jürgen,

 

Thanks for your help!

It helps so far that now I can change the name. Very good :-). I wouldn't have found it myself.

But now, with evey call, the name becomes longer and longer 😉 (without the post-expression). And somehow the program seems to evaluate the post-expression before saving the name in the report. So I can choose between a super long name and the default name.

Here is what i wrote:

 

Pre-Expression:

Locals.iStepNameLength= Len(Step.Name),
Step.Name = Parameters.sCallerSequence+Step.Name

 

Post-Expression:Step.Name = Right(Step.Name,Locals.iStepNameLength)

 

Meike

 

0 Kudos
Message 3 of 9
(9,730 Views)
Solution
Accepted by topic author Meike_Rempe

Hi Meike

 

Try to make it static.

Do not use Step.Name on the right side, use a local instead.

Step.Name = Parameters.sCallerSequence+Local.strName

 

If this will not help there is an other way to rename StepNames in report, by renaming it the ResultList.

but you need an additional step!!

 

 

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 4 of 9
(9,723 Views)

Hey Jürgen,

 

I had hoped that the solution would be easier :-(.

 

Thank you very much for your help. I learnd a lot!

 

Since my sequences are about 60 steps each (at the moment I have about 30 and it will be more), it's not so nice to save the step names in local variables. But it's also a lot of work to add additional test steps to change the names in the report.

Maybe I have to think about another way to get the structure clear in the report

 

Thanks again

 

Meike

0 Kudos
Message 5 of 9
(9,720 Views)

Be careful with dynamically changing the name of the step at runtime -- it can cause interesting things to happen if you are not careful.

 

Consider adding information to Step.ReportText to add clarification of what is actually happening.

 

Also, you probably want to avoid using the expression Step.Name, as it is not necessairly the name of the step (especailly if you use this on a custom step type that has a variable you added called Step.Name) use instead NameOf(Step) or Step.AsPropertyObject.Name to help make sure you get the name of the step.

0 Kudos
Message 6 of 9
(9,706 Views)

Hey Warren,

Thank you for the hint. Seems to be a good alternative to changing the step name.

Where can I add information to Step.ReportText? This variable does not seem to exist...(I tried to pass a value in the Post-Expressions field).

Meike

 

0 Kudos
Message 7 of 9
(9,681 Views)

Hi Meike,

 

Try to use Step.Result.ReportText

 

Regards

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 8 of 9
(9,656 Views)

Hey Jürgen,

 

You're right, this returns a text in the protocol. Thank you! 🙂

 

Unfortunately it is hidden somewhere in the report when the teststep is passed (I use the xml-report with stylesheet "expand.xml").

I suppose I have to learn to create my own stylesheet or report model or whatever.

 

Thanks again

Meike

0 Kudos
Message 9 of 9
(9,644 Views)