Testing
Advertisements
Related Guides
Unit Testing
| |
Mock objects are components that implement the same interface as real components but simulate their implementation. The following are illustrative examples.Unavailable ObjectsDevelopers commonly test their code as they write it. In the context of a project or sprint, there are often dependencies that aren't available yet. Mock objects may be developed as disposable placeholders.
IntegrationIntegration to systems and services may be replaced with mock objects to speed development. This may be done because such integrations are unavailable or unreliable in certain environments.SpeedReplacing slow objects with fast simulations.ScenariosMock objects may simulate scenarios and data that are difficult to produce with real objects. PredictabilityReplacing non-deterministic objects with a specific or predictable result set. For example, a mock object may replace a random number generator with a specific set of numbers.
Testing InputsOne of the primary differences between a mock object and a test stub is that mock objects tend to have expectations. For example, they may validate inputs. This can be useful for testing scenarios such as integration where you want to make sure you're sending valid requests.Destructive TestingReplacing real objects with objects that behave badly to test non-functional requirements such as reliability and resilience.|
Type | CodingUnit Testing | Definition | Objects that implement the same interface as real objects but simulate their implementation. | Value | TestingReplacing unavailable, troublesome, unpredictable or slow objects in particular environments. | Related Concepts | Unit TestingTest AutomationTest Stub |
Testing
This is the complete list of articles we have written about testing.
If you enjoyed this page, please consider bookmarking Simplicable.
© 2010-2023 Simplicable. All Rights Reserved. Reproduction of materials found on this site, in any form, without explicit permission is prohibited.
View credits & copyrights or citation information for this page.
|