Framework di simulazione
Nei test delle unità, spesso si è interessati a testare una porzione di un sistema completo, isolata dalle dipendenze. Per testare una porzione del sistema, si possono usare gli oggetti simulati che sostituiscono le dipendenze. Un oggetto simulato implementa almeno in parte la stessa interfaccia dell'oggetto di produzione, ma spesso in modo più semplice e veloce, nonché maggiormente prevedibile o controllabile.
Per iniziare, vedere Create Mock Object.
Classi
Argomenti
- Create Mock Object
Test a portion of a complete system in isolation using a mock.
- Specify Mock Object Behavior
Define behavior for mocked methods and properties. For example, you can specify that a method returns predefined values.
- Qualify Mock Object Interaction
Intercept messages sent from the component under test to the mock object. For example, you can verify that a method was called or a property was set.
- Write Tests That Use App Testing and Mocking Frameworks
Create fully automated tests for an app by using the app testing framework and the mocking framework.