Ejecutar pruebas unitarias
Seleccione y ejecute pruebas; personalice el ejecutor de pruebas; analice los resultados de pruebas y coberturas
Ejecute las pruebas de manera interactiva en el editor de MATLAB® o Live Editor, o en la app Test Browser, o ejecute las pruebas de forma programática, por ejemplo, con la función runtests
o el método run
de la clase matlab.unittest.TestSuite
. Personalice la ejecución de pruebas con opciones, como ejecutar pruebas en paralelo (requiere Parallel Computing Toolbox™) o especificar un nivel de detalle de las salidas de las pruebas. Recopile métricas de cobertura de código a medida que ejecuta las pruebas y analice los resultados de pruebas y coberturas.
Apps
Test Browser | Run MATLAB tests and view results (desde R2023a) |
Funciones
runtests | Run set of tests |
testsuite | Create suite of tests |
testrunner | Create 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 |
runInParallel | Run all tests in test suite in parallel |
Clases
matlab.unittest.TestCase | Superclass of all test classes |
matlab.unittest.TestSuite | Fundamental interface for grouping tests to run |
matlab.unittest.Test | Specification of a single test |
matlab.unittest.TestRunner | Class for running tests in unit testing framework |
matlab.unittest.TestResult | Result of running test suite |
matlab.coverage.Result | Result of code coverage analysis (desde R2023a) |
Espacios de nombres
matlab.unittest | Summary of classes and namespaces in MATLAB unit testing framework |
matlab.unittest.plugins | Summary of classes in MATLAB plugins interface |
matlab.unittest.selectors | Summary of classes in MATLAB selectors interface |
Temas
Ejecutar pruebas
- Create Simple Test Suites
Combine tests into test suites, whether they are organized in namespaces and classes or files and folders, or both. - Run Tests for Various Workflows
Explore different ways to run tests. - Run Tests Using Test Browser
Run your tests interactively by using the test browser. (desde R2023a) - Run Tests in Editor
Run your tests while working in the Editor or Live Editor. - Add Plugin to Test Runner
Add a plugin to the test runner. - Compile MATLAB Unit Tests
Create a standalone application to run your tests on target machines that do not have MATLAB installed.
Analizar resultados
- Analyze Test Case Results
Analyze the information that a test runner returns. - Analyze Failed Test Results
Identify and handle failed tests. - Rerun Failed Tests
Rerun failed tests quickly and conveniently. - Dynamically Filtered Tests
Assumption failures produce filtered tests that are marked asIncomplete
instead of producing test failures. Monitor the filtered tests for test code that the testing framework does not execute. - Programmatically Access Test Diagnostics
Programmatically access the diagnostics that the testing framework records on test results. - Types of Code Coverage for MATLAB Source Code
Use different types of code coverage to analyze your MATLAB source code. - Collect Statement and Function Coverage Metrics for MATLAB Source Code
Collect and analyze information about statement and function coverage for your MATLAB source code.