04-10-2014 08:44 AM - edited 04-10-2014 08:46 AM
Hello,
I'm using TestStand 2012 SP1 and Visual Studio 2010.
I want to run a TestStand sequence silently in my C# software.
I saw on this web site how to do to run a TestStand sequence (https://decibel.ni.com/content/docs/DOC-29585).
This example is really interresting to know how to run it using the .NET interop API.
The problem I can't solve is that no report is created when running the sequence although I added a step to setup the ReportOptions.
You will found here, the class I use to start the TestStand sequence :
public Execution StartSequence(string sequenceFilename, string resultDir, out SequenceFile seqFile) { Execution exec = null; try { User admin = Engine.GetUser("administrator"); Engine.CurrentUser = admin; SequenceFile seqFileModel = null; StationOptions stationOptions = Engine.StationOptions; stationOptions.DisableResults = false; stationOptions.AllowOtherModels = true; int flags = 107; // GetSeqFileOptions.GetSeqFile_OperatorInterfaceFlags; seqFile = Engine.GetSequenceFileEx(sequenceFilename, flags, TypeConflictHandlerTypes.ConflictHandler_Prompt); bool modelExists; string modelPath = seqFile.GetModelAbsolutePath(out modelExists); seqFileModel = Engine.GetSequenceFileEx(modelPath, GetSeqFileOptions.GetSeqFile_NoOptions, TypeConflictHandlerTypes.ConflictHandler_Prompt); // Setup the report options int reportOptionCallbackIndex = seqFile.GetSequenceIndex(DefaultModelCallbacks.DefModCback_ReportOptions); if (reportOptionCallbackIndex > -1) { seqFile.DeleteSequence(reportOptionCallbackIndex); } Sequence reportGenCallback = seqFile.CreateCallbackOverrideSequence(DefaultModelCallbacks.DefModCback_ReportOptions, false); InsertStatementStep(reportGenCallback, "Parameters.ReportOptions.DisableReportGeneration=False,\n" + "Parameters.ReportOptions.GeneratePath=False,\n" + string.Format("Parameters.ReportOptions.ReportFilePath=\"{0}\",\n", GenerateReportFilename(resultDir, sequenceFilename)) + "Parameters.ReportOptions.UseOnTheFlyReporting=True,\n" + "Parameters.ReportOptions.PurgeOnTheFlyResults=True"); exec = Engine.NewExecution(seqFile, "Single Pass", seqFileModel, false, 0, null, null, null); exec.Report.Location = resultDir; } catch (Exception) { throw; } return exec; }
What's wrong with my code and what should I do to get a report associated to the single pass ?
I hope someone will help me
Best Regards,
CFOE
Solved! Go to Solution.
04-13-2014 06:15 PM
Hi,
The process model creates the report. Does the Engine.NewExecution( ... seqFileModel...) call refer to a valid process model? Does your sequence file have a model option specified in the sequence file properties?
cc
04-14-2014 01:36 AM
Hi,
as far I could see while debugging, the process model associated to the sequence file is the SequentialModel and as far as I know, the SequentialModel can create a report.
I get the sequence file model using the command seqFile.GetModelAbsolutePath.
Best Regards,
CFOE
04-16-2014 04:47 AM
Hi,
This code works fine I just forgot to manage the Execution messages by polling.
Best Regards,
CFOE