フィルターのクリア

How remove test from test browser

4 ビュー (過去 30 日間)
Steven
Steven 2023 年 12 月 19 日
コメント済み: Steven 2023 年 12 月 20 日
I have two projects, each with test classes in a UnitTest folder in the project folder. In project A I add test by selecting the UnitTest folder. When I switch from project A to Project B how do I remove the unit tests that relate to project A?

採用された回答

atharva
atharva 2023 年 12 月 19 日
Hey Steven
I understand that you want to remove unit tests that are related to project A when you switch from project A to project B.
When you add multiple files, the test tree includes multiple parent nodes, each pointing to a different test file. You can remove a parent node and its children from the test tree by right-clicking the parent node and selecting Remove Test File. To remove all the tests from the test browser, click the three-dot button and select Remove all tests.This way you can remove the unit tests that relate to project A.
Alternatively, Use runtests Function:
If you prefer a programmatic approach, you can use the runtests function in MATLAB to run tests selectively. For example:
% Set the current folder to the UnitTest folder in Project B
cd('path_to_project_B/UnitTest');
% Run tests for Project B
result = runtests('*.m');
% Display the test results
disp(result);
This script runs all tests in the UnitTest folder for Project B. Adjust the path and file patterns according to your project structure. The goal is to ensure that only the relevant tests for the current project are included and executed.
You can go throught the MathWorks Documentation to have a better understanding of the runtests function
I hope this helps!
  1 件のコメント
Steven
Steven 2023 年 12 月 20 日
Thank you. That exactly what I needed. For some reason I thought ‘remove test file’ meant delete it, and I just didn’t even see the three dots icon.
I like the programmatic approach too, especially if I can find a way to switch test tests automatically in project open

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by