Main Content

setAssessmentsCallback

Class: sltest.testmanager.TestCase
Namespace: sltest.testmanager

Set test case assessment callback

Since R2020b

Syntax

setAssessmentsCallback(tc,callback)

Description

setAssessmentsCallback(tc,callback) specifies the assessment callback to assign to the specified test case. You can use an assessment callback to define variables to use in logical and temporal assessment conditions and expressions. The callback you specify appears in the Assessment Callback section of the test case in the Test Manager.

Input Arguments

expand all

Test case to which the assessment callback is associated, specified as an sltest.testmanager.TestCase object.

Data Types: string

Assessment callback, specified as a string. For a list of predefined variables you can use in a callback, see Logical and Temporal Assessment Syntax.

Example: "test_value = 20; increment_value = 5;"

Data Types: string

Examples

expand all

  1. Specify the test file and get the test suite and test case object in the file. Assume there is only one test suite and one test case in the file. If a test file contains more than one test suite, an array of test suites is returned from the getTestSuites method. If the file or suite contains more than one test case, an array of test cases is returned.

    tf = sltest.testmanager.TestFile('myTestFile.mldatx');
    ts = tf.getTestSuites();
    tc = ts.getTestCases();
  2. Specify the callback for the test case object.

    tc.setAssessmentsCallback("test_value = 20; end_value = 65;");
    

Version History

Introduced in R2020b