Files generated during testing are not saved

4 ビュー (過去 30 日間)
Michaela Konstantinou
Michaela Konstantinou 2021 年 9 月 16 日
I currently use R2021a version of matlab. I have an app created with appdesigner and I write some code to test it. I use matlab.uitest framework.
In the app some .m files are generated and I want to test if the are indeed generated so I count them with numel. However, after the testing is completed neither the files exist (when I run the app normally, they are generated as expected), nor the test passes.
In addition I have inserted a breakpoint before the end of the test function just to make sure that the teardown is not responsible for the absence of the files.
Is there any bug? The files that get created while testing get deleted or saved not in the determined folder but in another temp one? Can I prevent this from happening?
Thanks in advance
  1 件のコメント
Geoff Hayes
Geoff Hayes 2021 年 9 月 16 日
Michaela - in your code, how do you specify where the files should be written to? Do you include a full path or just file names?

サインインしてコメントする。

採用された回答

Steven Lord
Steven Lord 2021 年 9 月 16 日
I second Geoff Hayes's question about where you're creating these files. Are you putting them in a directory created using a TemporaryFolderFixture or a WorkingFolderFixture? If so the expected behavior of those fixtures is to delete those folders (and any files created in them) when the test completes unless there was a failure and you set the property to preserve the contents of those folders on failure.
"If you specify 'PreservingOnFailure' as true and a test using the fixture encounters a failure, the testing framework displays a message in the Command Window and does not delete the folder."
  1 件のコメント
Michaela Konstantinou
Michaela Konstantinou 2021 年 9 月 17 日
I found the "bug". I was manually typing in an edit field which displays (I thought it was an input source too..) the dir (chosen by a button) but the directory didn't change. So the files were saved in the default directory.. joke's on me..
Sorry

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTesting Frameworks についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by