What are mock objects, types of mock objects, how are they used in testing, and mocking frameworks?
- [Voiceover] As testers,…we wanna test our objects in isolation.…That is, testing units independent of other units.…This helps to eliminate impacts and side effects…that may be caused by other units.…This isn't always easy to do.…In fact, in some cases it's nearly impossible.…Most object methods interact with other objects.…Sometimes, those other objects are hard to create…or aren't suited to the testing environment.…For these situations,…we use what is called a mock object in testing.…
A mock is a stand-in object for the real object…that simulates the behavior of the real object.…When do you use a mock object in a test?…A prime use of mock object is a stand-in…for a yet to be created object.…In almost any project, some classes are created before…some of their associated classes are coded.…Mock objects can be created as fakes…until the real class is created.…Use a mock object when the real object…can't supply deterministic results.…That is, results that aren't the same…each time it's called upon.…
For example, a current time objects…
AuthorJames P White
- Why unit test?
- Unit testing tools
- Local testing with JUnit
- Working with JUnit assertions, rules, and categories
- Executing instrumented tests
- Filtering tests
- Testing with UI Automator and other testing tools
Skill Level Intermediate
UX Foundations: Usability Testingwith Chris Nodder1h 29m Beginner
1. Getting Started
2. Local Tests
3. Instrumented Tests
4. Other Android SDK Testing Tools
5. Mocking objects
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.