La traduction de cette page n'est pas à jour. Cliquez ici pour voir la dernière version en anglais.
Étendre les frameworks de test
Personnaliser l’environnement de test et créer des contraintes, des diagnostics, des dispositifs de test et des plugins
Le Unit Testing Framework de MATLAB® permet aux créateurs d’outils de test de personnaliser l’environnement de test. Vous pouvez approfondir l’écriture de tests grâce à des contraintes, diagnostics et dispositifs de test personnalisés. Vous pouvez également étendre l’exécution des tests et la création de rapports avec des plugins personnalisés pour l’exécuteur de tests.
Classes
Namespaces
matlab.unittest.constraints | Summary of classes in MATLAB constraints interface |
matlab.unittest.fixtures | Summary of classes in MATLAB fixtures interface |
matlab.unittest.plugins | Summary of classes in MATLAB plugins interface |
Rubriques
Contraintes
- Create Custom Constraint
Create a custom constraint to determine if a given value is the same size as an expected value. - Create Custom Boolean Constraint
Create a custom Boolean constraint to determine if a given value is the same size as an expected value.
Dispositifs de test
- Create Basic Custom Fixture
Create a basic custom fixture that changes the display format to hexadecimal representation. - Create Advanced Custom Fixture
Create a configurable fixture that changes the output display format for numeric values.
Plugins
- Write Plugins to Extend TestRunner
Use theTestRunnerPlugin
class to extend the test runner. You can implement methods to extend the creation, setup, running, and teardown of tests or test fixtures. - Create Custom Plugin
Create a custom plugin that counts the number of passing and failing assertions. - Run Tests in Parallel with Custom Plugin
Create a custom plugin that counts the number of passing and failing assertions when tests run in parallel. - Write Plugin to Add Data to Test Results
Create a plugin that adds the actual and expected values in an assertion to theTestResult
object. - Write Plugin to Save Diagnostic Details
This example shows how to create a custom plugin to save diagnostic details. The plugin listens for test failures and saves diagnostic information so you can access it after the framework completes the tests. - Plugin to Generate Custom Test Output Format
Create a plugin that uses a custom format to write finalized test results to an output stream.