using asynchronous tests with Eventually in a testscript with runtests
显示 更早的评论
The Eventually-method is great for testing time-related checks without having to wait a fixed sufficiently-high amount of time, but how do I get it working in a testscript with runtests.m, without rewriting my tests from a test-script to a test-class?
Minimum working example:
myTests.m:
import matlab.unittest.TestCase
import matlab.unittest.constraints.Eventually
import matlab.unittest.constraints.IsGreaterThan
testCase = TestCase.forInteractiveUse;
tic
testCase.verifyThat(@toc,Eventually(IsGreaterThan(1)))
When I run the tests as below, it crashes
runtests("myTests.m")
with the following short error (full error further down in comment):
Error using matlab.unittest.TestCase.forInteractiveUse
Unable to create an interactive TestCase while running a test.
Error in myTests (line 7)
testCase = TestCase.forInteractiveUse;
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Testing Frameworks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!