Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 509523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:01:10+00:00 2026-05-13T07:01:10+00:00

what is mock testing..How can we do mock testing..how to create mocks..when to use

  • 0

what is mock testing..How can we do mock testing..how to create mocks..when to use it

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:01:10+00:00Added an answer on May 13, 2026 at 7:01 am

    Mocks basically allow you to replace a concrete implementation of a class with a “fake” instance to simulate specific scenarios that you want to test.

    For example, suppose you have ClassA.DoSomething() method that accepts a ClassB instance as a parameter and uses it to do some work. You may want to test what happens in specific scenarios when ClassB is used within ClassA.DoSomething() (for example, what happens when ClassB.HelperMethod() is called and it returns a null).

    You can supply a “mocked” (fake) instance of ClassB, and tell it exactly how to behave from your test. For example, you would tell it to expect a call to “HelperMethod” and to return a null value for that call.

    Mocks are useful for allowing you to test individual units without relying on external dependencies. By mocking the external component, you remove the dependency on it from your tests and it means you focus your unit testing on your discrete component instead of doing integration testing which tests the integration between 2 components. A good example is a class that uses a data access layer to retrieve data from a database and then does some manipulation on the data. You can mock the data access layer to prevent the need from actually needing to go off to the database. So you can focus on testing how the class works rather than having to focus on setting up the db with all required test data and testing the integration with the DB. This has the added benefit of speeding up your tests too.

    Wikipedia has a good overview of mocking
    Android documentation on support for mocks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 342k
  • Answers 342k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer While I cannot speak to the first part of your… May 14, 2026 at 5:12 am
  • Editorial Team
    Editorial Team added an answer You could also put _root.myObj._visible = false; on the frame… May 14, 2026 at 5:12 am
  • Editorial Team
    Editorial Team added an answer You need to understand the mathematical theory of permutation cycles,… May 14, 2026 at 5:12 am

Related Questions

In the type of embedded programming I'm getting into, determinism and transparency of the
I have a very wierd problem happening to me during unit testing (MSTest in
I've asked this question over on the MSDN forums also and haven't found a
I've been a fan of EasyMock for many years now, and thanks to SO
Edit #2: Does anyone have a good method of testing the middle of a

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.