Main Content

createTemporaryFolder

Class: sltest.TestCase
Package: sltest

Create temporary folder

Description

example

folder = createTemporaryFolder(testCase) returns a temporary folder This folder is deleted based on the scope of the test case. For example, for a folder created by a method, that folder is deleted when the method is complete and goes out of scope. Temporary folders are useful if you want to use a separate folder to store methods of a test case. SeeCreate Temporary Folder for Each Test Method Write Plugins to Extend TestRunner for information on test case scope.

Input Arguments

expand all

Instance of the test case, specified as an sltest.TestCase object.

Output Arguments

expand all

Temporary folder, returned as a character vector.

Attributes

Accesspublic

To learn about attributes of methods, see Method Attributes.

Examples

expand all

classdef tempFolder < sltest.TestCase

    properties
       Folder;
    end
 
    methods (TestMethodSetup)
       function setup(testCase)
          testCase.Folder = ...
             testCase.createTemporaryFolder();
       end
    end
 
    methods (Test)
       function test1(testCase)
          testCase.simulate('myModel1',...
             'InFolder',testCase.Folder);
       end
 
       function test2(testCase)
          testCase.simulate('myModel2',...
             'InFolder',testCase.Folder);
       end
   end
end
Introduced in R2020b