Main Content

Esecuzione di test unitari

Selezionare ed eseguire i test; personalizzare il test runner; analizzare i risultati del test e del coverage

Eseguire i test in modo interattivo nell'Editor di MATLAB® o nel Live Editor, oppure nell'app Test Browser o, in alternativa, eseguire i test in modo programmatico, ad esempio con la funzione runtests o il metodo run della classe matlab.unittest.TestSuite. Personalizzare l'esecuzione dei test con opzioni, quali l'esecuzione dei test in parallelo (richiede Parallel Computing Toolbox™) o la specifica di un livello di dettaglio dell'output dei test. Raccogliere le metriche di coverage del codice durante l'esecuzione dei test e analizzare i risultati dei test e del coverage.

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
matlab.coverage.ResultResult of code coverage analysis (Da R2023a)

Namespaces

matlab.unittestSummary of classes and namespaces in MATLAB unit testing framework
matlab.unittest.pluginsSummary of classes in MATLAB plugins interface
matlab.unittest.selectorsSummary of classes in MATLAB selectors interface

Argomenti

Esecuzione di test

Analisi dei risultati