NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Add timestamp to report for each test step

Solved!
Go to solution

I have a test sequence where an absolute start time (yyyy-mm-dd HH:MM:SS.sss) should be included in the report for each test step. What is the easiest way to do this? Do I need to update each step (e.g. add this using additional results) or is there a more convenient way? There are about 90 test steps so I'd prefer if this could be done by e.g. customizing the report settings or adding a sequence callback?

 

I've found a couple of other posts regarding this subject, but I think the questions are left unanswered.

 

How to show timestamp in test report for each step - NI Community

Log the start time of each step to database - NI Community

0 Kudos
Message 1 of 4
(1,623 Views)
Solution
Accepted by topic author hunkel

I threw together a little example of one way to do this.  Check it and let me know if you have questions.  You can tweak the date time string sequence to get the format you like.

 

I think ultimately your best bet is to do it in the result processing plugin.  The TS.StartTime property should be in there and then you can calculate the rest.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 2 of 4
(1,572 Views)

Thanks. There are obviously multiple ways to implement this and I ended up with another solution using SequenceFilePreStep callback and a property object. The following was added in the callback sequence (and was a minimum a work), if someone else is looking for this

 

If {Contains({"PassFailTest", "NumericLimitTest", "NI_MultipleNumericLimitTest", "StringValueTest"}, RunState.CallingStep.StepType.Name, False)}

Statement Locals.StartTime = Time(True,0,0,0,Locals.Milliseconds) + "." + Str(Locals.Milliseconds),
RunState.CallingStep.AsPropertyObject.SetValString("Result.StartTime",1,Date() + " " + Locals.StartTime),
RunState.CallingStep.AsPropertyObject.SetFlags("Result.StartTime",0,PropFlags_IncludeInReport)

End

 

But your example seems to work as well and could be useful in other situations.

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

Glad you figured it out.

 

A couple thoughts:

I would use the step.TS.StartTime instead of the current time.  It's a titch more accurate but then again you won't notice.

Your way will slow down the entire execution, especially if tracing is on.  Mine is only called when something goes into the result collection.  Yours is called for every step.

 

Good luck!

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