Main Content

Esta página es para la versión anterior. La página correspondiente en inglés ha sido eliminada en la versión actual.

Pruebas unitarias basadas en clases

Escriba pruebas basadas en clases; parametrice pruebas; aplique accesorios; seleccione y ejecute pruebas

Escriba pruebas de estilo xUnit para comprobar que la salida del código de MATLAB® responde a sus expectativas. Las pruebas unitarias basadas en clases le brindan acceso a todas las funciones del marco de pruebas unitarias. Por ejemplo, puede escribir pruebas parametrizadas, etiquetar las pruebas o usar accesorios de prueba compartidos.

Para comenzar, consulte Author Class-Based Unit Tests in MATLAB y Write Simple Test Case Using Classes.

Apps

Test BrowserRun MATLAB tests and view results (desde R2023a)

Funciones

runtestsRun set of tests
testsuiteCreate suite of tests
testrunnerCreate test runner (desde 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

Clases

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

Espacios de nombres

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

Temas

Escribir pruebas

Escribir prueba parametrizada

Ejecutar pruebas y analizar resultados