A Scenario is used to schedule the execution of one or more TestCases. Each scheduled execution is called a Job. The Invert Sample includes a complete Scenario called Invert Example. In this exercise, we replace Invert Example with a new Scenario.

To build a new Scenario:

1.Click in the upper-right corner of the Scenario box to close Invert Example.

2.Select File->New->Scenario from the main menu.

3.Name the Scenario MyScenario and click OK.

4.Enter a description of the Scenario if desired.

5.Save the Scenario.

You can now add Jobs to the Scenario. A Job controls the execution of a TestCase. To add jobs:

1.Add the Init job:

a.Click the Add button in the Scenario box and select Existing.

b.Click the browse button 3dots_button and select the Init.mxc TestCase.

c.Leave the Precondition(s) field blank.

d.Leave Run Count set to one.

e.Click OK.

2.Add the Tick job:

a.Click the Add button in the Scenario boxand select Existing.

b.Click the browse button 3dots_button and select the Tick.mxc TestCase.

c.Enter 1 in the Precondition(s) field.

d.Set the Run Count to Forever. The Tick TestCase is 0.05 seconds long. It repeats for the entire time the Scenario is running.

e.Click OK.

3.Add the MyTestCase job:

a.Click the Add button in the Scenario boxand select Existing.

b.Click the browse button 3dots_button and select the MyTestCase.mxc TestCase.

c.Enter 1 in the Precondition(s) field.

d.Leave Run Count set to one.

e.Click OK.

GS-Scenario

Your Scenario is now ready to run. On the tool bar, click the Run Run_btn button and watch your test case execute. If everything works correctly, you should see the output signal toggle inverse to the input signal. Note that the test run is marked as Failed. This is because the expected results are undefined. If the results are as intended, select the signal and click Accept Results or press Ctrl+Shift+A. To rerun, click on the Rewind icon:

Rewind

Now click Run again. This time the tests should pass.

 

InvertResult

The Init TestCase sets the signals to their initial values. Every time the Tick TestCase calls ("ticks") the Task_5ms function, it checks the value of InVal and sets OutVal to its inverse. MyTestCase defines the transitions of the InVal signal, displays the transitions of OutVal, and compares them to defined expected results.

Try adding more complex waveforms to the input signal and rerun the test case.

 

InvertResult2

This concludes our discussion of the Invert example. Every new TestCase and Scenario is just a simple extension of this example.

 

Related Topics:

Getting Started with a Custom Harness

Getting Started Video Demonstration

Working with Scenarios

Exercises and Examples