polyspace.project.TestCaseRef Class
Namespace: polyspace.project
Description
This Python® class contains information about a graphical test case that is saved in a
.pstestd file, referenced by a Polyspace® Platform project. When you reference a .pstestd file from a
project, it is called a test reference. Saving your graphical test cases in
.pstestd files and referencing those files from one or more projects
enables you to create a modular project structure that improves sharing and version control
managed workflows. For more information about project structure, see Modularize Project by Using External Configurations, Test References, and External Stub Files.
To work with test references, use this class, which contains the name of the graphical
test and the path to the .pstestd file, together with the polyspace.project.TestCase class, which contains the actual test case definition.
You can also work with test references in the Polyspace Platform user interface.
To create and manage test cases that are owned by the project, use the polyspace.project.OwnedTestCase class.
Creation
Syntax
Description
Import Test Case by Reference
testCaseRef = testSuite.TestCaseRefs.add(
adds a reference from the test suite testCase, testCaseRefName)testSuite to
testCase, where testCase is an existing
polyspace.project.TestCase object or the path to a
.pstestd file. The Name property of the
resulting polyspace.project.TestCaseRef object is set to
testCaseRefName. For more information on the
polyspace.project.TestSuite object and its methods, see the
description of the TestSuites
property of the polyspace.project.Project class.
testCaseRef = testSuite.TestCaseRefs.add(
adds a reference to testCaseRefObj)testCaseRefObj from the test suite
testSuite and inherits the test case name. For more information on
the polyspace.project.TestSuite object and its methods, see the
description of the TestSuites
property of the polyspace.project.Project class.
testCaseRef = testSuite.TestCaseRefs.add(
adds a reference to testCaseRefObj, testCaseRefName)testCaseRefObj from the test suite
testSuite. Use the testCaseRefName argument to
set the Name property of the resulting testCaseRef
object. For more information on the polyspace.project.TestSuite
object and its methods, see the description of the TestSuites
property of the polyspace.project.Project class.
Convert Test Case
testCaseRef = testSuite.TestCaseRefs.moveAsRef(
converts the existing ownedTestCaseObj,testFile)ownedTestCaseObj in
testSuite to a polyspace.project.TestCaseRef
object and saves the graphical test case from ownedTestCaseObj in the
file testFile.pstestd. After conversion, the project references the
test case saved in testFile.pstestd. You can specify
testFile as an absolute or relative path, where relative paths
are considered relative to the location of the .psprjx project file.
The resulting polyspace.project.TestCaseRef object has its
Path property set to testFile and its
Name property is inherited from the owned test case.
testCaseRef = testSuite.TestCaseRefs.moveAsRef(
converts the existing ownedTestCaseObj,testFile, testCaseRefName)ownedTestCaseObj in
testSuite to a polyspace.project.TestCaseRef
object and saves the graphical test case defined in ownedTestCaseObj
in the file testFile.pstestd. After conversion, the project
references the test case saved in testFile.pstestd. You can specify
testFile as an absolute or relative path, where relative paths
are considered relative to the location of the .psprjx project file.
The resulting polyspace.project.TestCaseRef object has its
Path property set to testFile and its
Name property is set to the testCaseRefName
argument you provide.
Input Arguments
Properties
Methods
Examples
Version History
Introduced in R2026a
See Also
polyspace.project.Project | polyspace.project.CodeInfo | polyspace.project.TestCase | polyspace.project.OwnedTestCase | polyspace.project.ScriptedTestStep | polyspace.project.TabularTestStep
Topics
- Author Graphical Tests Using Python API for Polyspace
- Create Easily Shareable Projects for Version Control
- Modularize Project by Using External Configurations, Test References, and External Stub Files
- Modularize Existing Project by Using Polyspace Python API
- Create Project Dynamically by Using Polyspace Python API