Main Content

La traduzione di questa pagina non è aggiornata. Fai clic qui per vedere l'ultima versione in inglese.

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 TestSuite array 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 matlab.unittest framework
matlab.unittest.TestResultResult of running test suite

Pacchetti

matlab.unittestSummary of packages and classes in MATLAB Unit Test 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 Test 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 (Da R2019a)

Argomenti

Scrittura di test

Scrittura di test parametrizzati

Esecuzione dei test e analisi dei risultati