CT 2024.12 provides a scenario testing feature that allows testing various scenarios. Using the scenario tests of CT 2024.12, you can test several functions that are periodically called.
Convert to Scenario Test
Select [Test Editor] > [Test Info] > [Test Target Function] > [Convert to Scenario test] to convert a normal test to a scenario test. Once converted, it cannot be reverted to a normal test.
- Cases where you cannot convert to scenario tests
- Project language isn’t C.
- If [Test Target Function] includes functions that cannot be used as periodic functions.
- Functions usable as periodic functions are those with a return type of void and no parameters.
Designing Scenario Tests
After converting to scenario test, you can design scenario tests in [Test Info] and [Test Case] tabs of [Test Editor]. The context of the test cases is maintained in scenario test.
Designing Scenario Tests – [Test Info] Tab
When converting to scenario test, scenario variables are added to [Test Info] tab, and the editor for [Test Target Function] is changed.
Scenario Test Icons
Icon | Description |
Initial function | |
Periodic function |
Test Target Function
- Initial Function
- A function called once before the cycle begins
- You can add functions like global variable initialization that need to be executed before running tests.
- Periodic Function
- A function repeatedly called at regular time intervals
- To be a periodic function, it must have a return type of void and no parameters.
- Diverse designs are possible using user code and before/after call code.
- Cycle Time
- The time interval for function repetition
- Adjust the test running time by inputting suitable values for scenario variables in [Test Case] tab.
- Cycle Unit Settings
- Set the representation unit for the cycle in ms, μs, or ns in [Test Editor] and test reports. The default unit can be changed in project properties.
- Add initial function/Add periodic function
- Selecting [Add initial function] displays all functions in the list.
- Selecting [Add periodic function] shows only functions usable as periodic functions.
- When adding a periodic function, the start time is set to 0, and the cycle time is set to 10.
- Remove
- Deletes initial and periodic functions. Deletion is possible if there are more than two periodic functions.
- Up/Down
- Moves initial and periodic functions up/down to change the call order.
- Set related file
- Sets or changes the source code containing that function.
Functions
Select periodic functions to set start time and cycle time.
Scenario Variables
- Duration: Variable for inputting running time per test case
- Total Duration: Variable for outputting the total time that scenario test has run
Designing Scenario Tests – [Test Case] Tab
In [Test Case] tab of scenario test, you can check scenario variables. Input value per test case in [Duration], then run the test to confirm the actual execution time displayed in [Total Duration].
Need more help with this?
Don’t hesitate to contact us here.