How can I test if a function is executed without any error using the unit test framework in MATLAB R2020b?

40 次查看(过去 30 天)
Hi, I am using the MATLAB Unit Test Framework, which includes a verification function called "verifyWarningFree". This function can verify if a function runs without any warnings. However, I would like to check if the function executes without any errors, not just warnings. Is there a command available that can achieve this?

采纳的回答

MathWorks Support Team
MathWorks Support Team 2024-12-30,0:00
编辑:MathWorks Support Team 2024-12-30,14:20
You can simply invoke the function being tested, and the test framework will report a failure if the function executes with any error.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Write Unit Tests 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by