in the attached sequence i am renaming a teststep in a loop.
The new stepname should be the old stepname + a prefix which is the loopcounter
So old name is: 123
New names should be
loop: 1 - 123
loop: 2 - 123
loop: 3 - 123
But the sequence creates:
loop: 1 - 123
loop: 2 - loop: 1 - 123
loop: 3 - loop: 2 - loop: 1 - 123
Any idea how to solve this?
Solved! Go to Solution.
Maybe this helps
You need to store the original name in a temp variable and restore it after the step has executed. During run time, the step saves its name, which is why the step name continues to grow in your loop.
This is also discussed in several threads, such as this one:
thanks for the link and the idea of the temp-variable.
I got another idea:
What if i call the default teststep: "Loop: x - 123"
And the "Change Step name" should take the NextStep.Name, then cut everything up to the "-" (something like fromthrough(0, "-") and paste the new loop-text before the rest. And if all loops just cut the old text up to the "-" it should work.
Question is only how to do the cut&paste thing in the expression...
That would work too. I would use a combination of Mid and Find. This expression would work, but you may need to tweak for your specific needs:
Mid(RunState.PreviousStep.Name,Find(RunState.PreviousStep.Name," - ")+Len(" - "))
The Find function finds the index of the dash in the previous step name and also adds the string of the dash. The Mid function will split the string at that index.
"Loop: " + Str(Locals.i) + " - " + Mid(RunState.NextStep.Name,Find(RunState.NextStep.Name," - ") + Len(" - "))
Thx a lot
You can use:
"Loop: " + Str(Locals.i) + " - " + (Find(RunState.NextStep.Name," - ")<0?RunState.NextStep.Name:Mid(RunState.NextStep.Name,Find(RunState.NextStep.Name," - ")+Len(" - ")))
The comparison is needed because the first run doesn't have a dash in it.