Main Content

Questa pagina si riferisce alla release precedente. La corrispondente pagina in inglese è stata rimossa nella release attuale.

Test delle unità basati su classi

Scrivere test basati su classi; parametrizzare i test; applicare gli impianti; selezionare ed eseguire i test

Scrivere test in stile xUnit per verificare che l'output del codice MATLAB® sia quello previsto. I test delle unità basati sulle classi consentono di accedere a tutte le funzionalità del framework di test delle unità. Ad esempio, è possibile scrivere test parametrizzati, etichettare i test o utilizzare gli impianti di test condivisi.

Per iniziare, vedere Author Class-Based Unit Tests in MATLAB e Write Simple Test Case Using Classes.

App

Test BrowserRun MATLAB tests and view results (Da R2023a)

Funzioni

runtestsRun set of tests
testsuiteCreate suite of tests
testrunnerCreate test runner (Da R2021a)
run (TestSuite)Run test suite using default test runner
run (TestRunner)Run test suite
run (TestCase)Run tests corresponding to test case
runInParallelRun all tests in test suite in parallel

Classi

matlab.unittest.TestCaseSuperclass of all test classes
matlab.unittest.TestSuiteFundamental interface for grouping tests to run
matlab.unittest.TestSpecification of a single test
matlab.unittest.TestRunnerClass for running tests in unit testing framework
matlab.unittest.TestResultResult of running test suite

Namespaces

matlab.unittestSummary of classes and namespaces in MATLAB unit testing framework
matlab.unittest.qualificationsSummary of classes in MATLAB qualifications interface
matlab.unittest.constraintsSummary of classes in MATLAB constraints interface
matlab.unittest.fixturesSummary of classes in MATLAB fixtures interface
matlab.unittest.parametersSummary of classes associated with MATLAB unit testing parameters
matlab.unittest.pluginsSummary of classes in MATLAB plugins interface
matlab.unittest.selectorsSummary of classes in MATLAB selectors interface
Simulink.sdi.constraints.MatchesSignalConstraint that compares time series data with tolerances using the Simulation Data Inspector

Argomenti

Scrittura di test

Scrittura di test parametrizzati

Esecuzione dei test e analisi dei risultati