NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Using StepInto

I wish to use The StepInto method from the Execution class.

I open a file using the ApplicationMgr. I obtain an Execution reference from ExecutionViewMgr->Execution. Immediately after I call the StepInto method as such: Execution->StepInto. I do not notice any change in the SequenceFileViewMgr.

Am I missing any steps?
0 Kudos
Message 1 of 20
(5,057 Views)
First, make sure you are only calling StepInto on an execution that is suspended.

Next, you should use a command object instead of the underlying engine API for an action when a command exists for that action. The command ensures that the action is valid and the command updates the connected TestStand UI controls as needed.

For your case, use something like:


// step into the selected execution
this.axExecutionViewMgr.GetCommand(CommandKinds.CommandKind_StepInto, 0).Execute(true);
0 Kudos
Message 2 of 20
(5,042 Views)
I've done the following and no changes have been reflected on the UI controls:

mCommand = mExecutionViewMgr->GetCommand(CommandKind_StepInto, 0);
mCommand->Execute(true);

Is a sequence file that has just been loaded considered 'suspended'. If not, how do I force it into that mode?
0 Kudos
Message 3 of 20
(5,039 Views)
A sequence file that is just loaded does not have any executions associated with it. Once you create an execution from the sequence file, it will be in one of three states-

ExecRunState_Paused–(Value: 2) The execution is suspended.
ExecRunState_Running–(Value: 1) The execution is running.
ExecRunState_Stopped–(Value: 3) The execution has finished executing.

StepInto will allow you to debug code modules if the adapter is configured in a way to do this. It is the same thing that happens if you pause an execution and select Debug >> Step Into from the Sequecne Editor.

Allen P.
NI
0 Kudos
Message 4 of 20
(5,035 Views)
Ahh, you are trying to both start a new execution AND step into it. You can use the ApplicationMgr.BreakOnFirstStep property to get step into behavior. How you start the execution depends slightly on what kind of execution you want. Try something like the following


bool savedVal = this.axApplicationMgr.BreakOnFirstStep; // save this application wide setting
this.axApplicationMgr.BreakOnFirstStep = true;

// use one of the following three lines:

// run using first entry point, usually Test UUTs
this.axSequenceFileViewMgr.GetCommand(CommandKinds.CommandKind_ExecutionEntryPoints_Set, 0).Execute(true);

// run using second model entry point, typically Single Pass
this.axSequenceFileViewMgr.GetCommand(CommandKinds.CommandKind_ExecutionEntryPoints_Set, 1).Execute(true);

// run without a model entry point
this.axSequenceFileViewMgr.GetCommand(CommandKinds.CommandKind_RunCurrentSequence, 0).Execute(true);


this.axApplicationMgr.BreakOnFirstStep = savedVal;
0 Kudos
Message 5 of 20
(5,033 Views)
I am calling StepInto repeatedly in a loop. It steps into the sequence the first time around but doesn't after that. I tried calling ResumeExecution after the first StepInto but I get a runtime error.

Do I need to do anything between 'StepInto's?
0 Kudos
Message 6 of 20
(5,023 Views)
Actually, I've been using mSequenceFileViewMgr->Run() to run my seq. files and it works fine and it stops at first step.

Why is the following line not working though: mSequenceFileViewMgr->GetCommand(CommandKind_RunCurrentSequence, 0)->Execute(true) ?

Similarly, StepInto doesn't work either: mExecutionViewMgr->GetCommand(CommandKind_StepInto, 0)->Execute(true)?

When I debug, it goes over the line but nothing happens.
0 Kudos
Message 7 of 20
(5,013 Views)
For debugging, before calling Execute, check the Enabled property of the command. It might be disabled because the you are trying to execute the command at an inappropriate time or with the wrong view manager.

Also, try connecting the commands to buttons and see if the buttons are enabled and functional.

- James
0 Kudos
Message 8 of 20
(5,013 Views)
I connected the command to a button. The button was greyed (disabled) at first. After a bit of playing around and observing when the button would be enabled, I figured out that I had to logged in before I could use it.

Now, I have to figure out a way to auto-login "administrator".
0 Kudos
Message 9 of 20
(5,006 Views)
Ok, figured out how to autologin. The "StepInto" button is active when I start the application but my code still doesn't work.

I use the ApplicationMgr to OpenSequenceFile. I set BreakOnFirstStep to true, then I use Run from SequenceFileViewMgr. This is followed by my StepInto commands. I also set Enabled on the command to true before executing.

Any clues?
0 Kudos
Message 10 of 20
(5,003 Views)