NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Rename report path with the test result

Hi,
I would like to append the test result to the report file name automatically at the end of the sequence. I am able to change the report name using the test report callback. But I am unable to append the result status to the end of the file name as I couldnot access the complete test report file name.
 
Regards
Gopal
0 Kudos
Message 1 of 7
(5,504 Views)
Hey Gops,
 
So you probably know by now that the report name is being determined by the Determine Report File Path in the entry point of your process model.  If you change the name of your report before that then it will get changed to whatever that step tells it to be.   BTW- that step assigns the path to the Locals.ReportFilePath in your entry point.  At this time you have a physical file located on your machine named whatever that step named it.  The name is based on your report settings in Configure>>ReportOptions on the Report File_Pathname tab.  So by the time you get to Test Report Callback then you can change the variables but it doesn't change the fact that the file is already named on the disk. 
 
The best thing might be to just copy that file to a new location and name it something else (including your test result) in your Process Cleanup Callback. 
 
I didn't try it yet but you could try and change the Runstate.Root.Locals.ReportFilePath to something else after that step in one of the callbacks.  Problem with that is that if you open your entry point and do a search for Locals.ReportFilePath you'll notice it gets used a lot.  I don't know if this would affect the change or something else.  It's always scary changing variables in the process model.  Be careful.
 
Anyhow, I hope that helps clarify a few things and confuses you some more.
 
peace out,
0 Kudos
Message 2 of 7
(5,476 Views)

I do this very thing. I create a special format for the report file name with Pass or Fail (or Error or Termanated) at the end of the file name. By setting the report options just right reuses the same report file name when it creates it before the test are run. Then after the test is run in the TestReport callback I set the ReportFilePath with the file name that I want based on the test results.

RunState.Root.Locals.ReportFilePath =
Parameters.ReportOptions.Directory + "\\" +
Parameters.ReportOptions.BaseName +
Parameters.UUT.SerialNumber + "_" +
Str(Parameters.StartDate.Year,"%04d") +
Str(Parameters.StartDate.Month,"%02d") +
Str(Parameters.StartDate.MonthDay,"%02d") + "_" +
Str(Parameters.StartTime.Hours,"%02d") +
Str(Parameters.StartTime.Minutes,"%02d") +
Str(Parameters.StartTime.Seconds,"%02d") + "_" + 
Parameters.MainSequenceResults.Status + ".xml"

I only have a single empty report file that is not used, but I get all the report files with names based on the test result.

Now to prevent someone changing the report options 

Message 3 of 7
(5,433 Views)

Sorry clicked before I was done

I do this very thing. I create a special format for the report file name with Pass or Fail (or Error or Terminated) at the end of the file name. By setting the report options just right reuses the same report file name when it creates it before the test are run. Then after the test is run in the TestReport callback I set the ReportFilePath with the file name that I want based on the test results.

In the ReportOption call back I set the report options.

Parameters.ReportOptions.GeneratePath = False
Parameters.ReportOptions.NewFileNameForEachUUT = True
Parameters.ReportOptions.AppendToFileIfItExists = False
Parameters.ReportOptions.DirectoryType = "SpecificDirectory"
Parameters.ReportOptions.Directory = { To What ever Directory you need }

Parameters.ReportOptions.BaseName =
Right( RunState.ProcessModelClient.Path , Len( RunState.ProcessModelClient.Path ) - Find( RunState.ProcessModelClient.Path , "\\" , 0 , True , True ) -1 ) ,

Parameters.ReportOptions.BaseName =
Left( Parameters.ReportOptions.BaseName , Find( Parameters.ReportOptions.BaseName , "." , 0 , True , True ) ) + "_"

Parameters.ReportOptions.ReportFilePath = Parameters.ReportOptions.Directory + "\\"
Parameters.ReportOptions.UseFormatForExtension = True
Parameters.ReportOptions.DisableReportGeneration = False

Then in the TestReport callback I rename the ReportFilePath

RunState.Root.Locals.ReportFilePath =
Parameters.ReportOptions.Directory + "\\" +
Parameters.ReportOptions.BaseName +
Parameters.UUT.SerialNumber + "_" +
Str(Parameters.StartDate.Year,"%04d") +
Str(Parameters.StartDate.Month,"%02d") +
Str(Parameters.StartDate.MonthDay,"%02d") + "_" +
Str(Parameters.StartTime.Hours,"%02d") +
Str(Parameters.StartTime.Minutes,"%02d") +
Str(Parameters.StartTime.Seconds,"%02d") + "_" + 
Parameters.MainSequenceResults.Status + ".xml"

This gives report files like

My_TestSequence_1234_20070728_200018_Failed.xml
My_TestSequence_1234_20070728_200018_Passed.xml

Jim D.

Message 4 of 7
(5,431 Views)

Hi,

Thanks for the suggestions. I have used the Process clean up where I call a VI to copy the current report file (from Runtime.Root.Locals.Reportfilepath) to the required name with status information from Runtime.Root.Locals. Results[0].Status.

In the VI I manupulate the file name to my requirement and use it as the destination parameter for copy file VI. Then I delete the report file generated by teststand.

This works fine for the current requirement.

Regards
Gopal

0 Kudos
Message 5 of 7
(5,408 Views)

In reponse to Gopal's original question of appending the result of a UUT to the Report File Path,

TestStand 4.2 gives you the ability to specify the report path using Expressions as well right from the Report Options dialog box. For instance, using the  

<UUTStatus> macro, you could specify that reports for UUTs that Pass versus those that Fail go to different locations.

For more information on this, refer to:
NI TestStand Help: Specifying Report File Paths by Expression
NI TestStand 4.2 Release Notes: Using Expressions to Customize Report File Paths

Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 6 of 7
(4,970 Views)

Hi OmarGator..

 

It’s a very old post but I’m stuck with the same issue. 🤔

 

Filled the ReportOption callback, and the TestReport callback as suggested.

 

But I’m a bit puzzled.

 

In the ReportOption callback the variable RunState.ProcessModelClient.Path is not known,

and in the TestReport callback  the variable Parameters.MainSequenceResults.Status is not known.

 

Can you help me with the details to get it running ?. A great help will be a example sequence file.

 

Thanks a million.. 😊

0 Kudos
Message 7 of 7
(2,720 Views)