How to use runtests() command

3 views (last 30 days)
doyz
doyz on 21 Aug 2018
I have created a test script Test1.m using classes located in a folder called "test".
classdef Test1 < matlab.unittest.TestCase
... code...
end
I can run the tests by entering
run(Test1)
in the command window. Some members of my team are familiar with clicking 'Run Tests' button (or the equivalent of runtests() in command window). However, runtests("Test1.m") does not work with the below error:
Error using runtests
Do not know what to run. Try "unit" or
"acceptance"
Is it due to the folder structure? How may i be able to run test script with 'Run Tests' button.

Answers (1)

Viggnesh Venkatakrishnan
Viggnesh Venkatakrishnan on 17 Dec 2018
Hi doyz,
I understand your problem with using runtests() to run the test script that you have written. I can safely assume with your code snippet that you are working with class based unit tests in MATLAB. There is a specific way to write class based unit tests for it to be registered as tests in MATLAB. Refer to the following page and the example given in the page that talks in detail about class based unit tests in MATLAB.
Thanks and Regards,
Viggnesh Venkatakrishnan

Categories

Find more on Testing Frameworks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!