Add Tags to Test Case Description

2 ビュー (過去 30 日間)
Pat Canny
Pat Canny 2022 年 6 月 3 日
編集済み: Pat Canny 2022 年 6 月 3 日
I would like to use tags (e.g., "#equivalencetests") in my test case descriptions to help me find test cases more easily in the future. Is there a way to do this programmatically in Simulink Test?

採用された回答

Pat Canny
Pat Canny 2022 年 6 月 3 日
編集済み: Pat Canny 2022 年 6 月 3 日
This can be done using a few functions:
testfile = sltest.testmanager.TestFile("test_file.mldatx"); % create new test file
testsuite = sltest.testmanager.TestSuite(testfile,"New Test Suite"); % create new test suite in test file
testcase1 = sltest.testmanager.TestCase(testsuite,'equivalence',"First Equivalence Test Case"); % create a new test case within the test suite
testcase2 = sltest.testmanager.TestCase(testsuite,'equivalence',"Second Equivalence Test Case");% create a second new test case within the same test suite
testCases = getTestCases(testsuite) % list the test cases within that test suite
testCases(1).Description = "First Equivalence Test Case #equivtest"; % create a description for the first test case using a tag
testCases(2).Description = "Second Equivalence Test Case"; % create a description for the second test case without using a tag
testCases = getTestCases(testsuite) % list the test cases again
testCaseDescriptions = string({testCases.Description}); % get the test case descriptions
equivTests = contains(testCaseDescriptions,"#equivtest"); % find only test cases with tag in description
testCases(equivTests) % display test cases with tag

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResults, Reporting, and Test File Management についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by