Mock vs Mock Server
A mock is a fake object inside one test, in the same program. A mock server is a fake API that runs on its own, over the network. Many tests and apps can call the same mock server.
Mock (Testing)
A fake part that records how your code called it, so a test can check.
A mock is a test double that records how it was called, so the test can check it. You hand it to your code in place of the real part. After the code runs, you ask the mock: were you called, how many times, and with what? That lets you test that your code sent an email without sending one. Most test tools have mocks built in.
Mock Server
A fake API that sends back set answers, for building and testing.
A mock server is a fake API that sends back set answers. It copies the real API's endpoints and replies. Front-end teams use one to build before the real API exists. Tests use one so they do not hit a slow or costly real service. It can also fake errors that are hard to cause for real.
In one line
- Mock (Testing)
- A fake part that records how your code called it, so a test can check.
- Mock Server
- A fake API that sends back set answers, for building and testing.