Documentation

sltest.testmanager.copyTests

Copy test cases or test suites to another location

Syntax

objArray = sltest.testmanager.copyTests(srcObjArray,targetObj)

Description

example

objArray = sltest.testmanager.copyTests(srcObjArray,targetObj) copies test cases or test suites to another test file or test suite.

Examples

collapse all

% Create test structure
tf = sltest.testmanager.TestFile('Test File');
ts_orig = tf.createTestSuite('Original Test Suite');
tc1 = ts_orig.createTestCase('baseline','Baseline Test Case 1');
tc2 = ts_orig.createTestCase('baseline','Baseline Test Case 2');

% Create new test suite for the target location
ts_new = tf.createTestSuite('New Test Suite');

% Copy test cases to new test suite
objArray = sltest.testmanager.copyTests([tc1,tc2],ts_new)
objArray = 

  1x2 TestCase array with properties:

    Name
    Description
    Enabled
    ReasonForDisabling
    TestFile
    TestPath
    TestType
    Parent
% Look at the details of the object array
objArray(1)
ans = 

  TestCase with properties:

           Name: 'Baseline Test Case 1'
    Description: ''
        Enabled: 1
       TestFile: [1x1 sltest.testmanager.TestFile]
       TestPath: 'Test File > New Test Suite > Baseline Test Case 1'
       TestType: 'baseline'
         Parent: [1x1 sltest.testmanager.TestSuite]

Input Arguments

collapse all

Test cases or test suites to copy, specified as an array of sltest.testmanager.TestCase or sltest.testmanager.TestSuite objects.

The destination test file or test suite to copy to, specified as an sltest.testmanager.TestFile or sltest.testmanager.TestSuite object.

Output Arguments

collapse all

Test cases or test suites at the target destination location, returned as an array of sltest.testmanager.TestCase or sltest.testmanager.TestSuite objects.

Introduced in R2015b

Was this topic helpful?