matlab.unittest.TestCase automatic retry

We have a test suite that relies on an external process. That process seems to be ... flaky. Since the process is a local webserver, my idea is to catch exceptions thrown when the HTTP request from Matlab times out, using a listener on the matlab.unittest.TestCase:
testCase.addlistener('ExceptionThrown', @(src, evnt) ..)
then relaunch the flaky process, and rerun the test case.
I've written a class derived from TestRunnerPlugin to manage most of this, but I cannot figure out how to re-run the test case. Any ideas?

답변 (1개)

Steven Lord
Steven Lord 2022년 8월 8일

0 개 추천

This isn't directly an answer to your question, but as an alternative to always needing to rerun some or all of your tests can you mock the web server for most of your tests? The mock ought to be more stable than the real web server.

댓글 수: 1

Not really, no. The test suite is being (mis-) used as more of an integration test than a unit test, and the tests rely heavily on the data returned by the webserver.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 MATLAB Production Server에 대해 자세히 알아보기

제품

릴리스

R2020b

질문:

2022년 8월 8일

댓글:

2022년 8월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by