Nota dell'editore: This file was selected as MATLAB Central Pick of the Week
OVERVIEW
I initially wrote MockObject to help me unit test code that connected to hardware devices using COM objects. By swapping in a mock for the actual COM object, I could could simulate any device behavior I wanted.
I've since used it to mock HTTP sessions as well, and it's probably useful wherever you want to mock out Something Big.
FEATURES
The MockObject class has two main features:
* It maintains a lookup table of function return values: for any function, for a specific function, or for a specific function with specific arguments
* It maintains a list of what methods were called, along with the arguments used.
EXAMPLES
See the example subdirectory for an example of how this would work.
REQUIREMENTS
MockObject will _probably_ run on any version of MATLAB back to R2008a. It certainly won't work on anything older, as it uses classdef-based classes.
Cita come
Paul Sexton (2026). MockObject (https://github.com/psexton/MockObject), GitHub. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
- MATLAB > External Language Interfaces > Web Services with MATLAB > Call Web Services from MATLAB Using HTTP >
Tag
Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
example
src
src/mockobject
tests
Le versioni che utilizzano il ramo predefinito di GitHub non possono essere scaricate
| Versione | Pubblicato | Note della release | |
|---|---|---|---|
| 1.1.0.0 | Changing file link to point to the github repo. |
|
|
| 1.0.0.0 |
