Main Content

sltest.testmanager.CustomCriteria class

Package: sltest.testmanager

Add or modify custom criteria

Description

An instance of sltest.testmanager.CustomCriteria is a test case custom criteria that evaluates the simulation output, returning a pass or fail result.

The sltest.testmanager.CustomCriteria class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

obj = getCustomCriteria(tc) creates an sltest.testmanager.CustomCriteria object for a test case object tc.

Properties

expand all

Property that enables or disables the custom criteria for evaluation, specified as a logical.

Example: true

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Property that defines the custom criteria script, specified as a character array.

Example: test.verifyEqual(lastPhi,0,['Final: ',num2str(lastPhi),'.'])

Attributes:

SetAccess
public
GetAccess
public
Dependent
true
NonCopyable
true

Examples

collapse all

Create a test case object from the test suite ts.

tc = ts.getTestCaseByName('Requirement 1.3 Test');

Get the custom criteria from the test case tc.

tcCriteria = getCustomCriteria(tc);

Set the custom criteria script.

tcCriteria.Callback = 'test.verifyEqual(lastPhi,0);'

Enable the custom criteria.

tcCriteria.Enabled = true;
Introduced in R2016b