Skip to content

What is fake

Devrath edited this page Jul 8, 2021 · 3 revisions

Describing the scenario

  • Suppose we want to check the memory usage of a function
  • The function create 1000 records and we need to check this
  • Here we use the fakes

What are the fakes

  • Fakes are almost the working implementation
  • But it is a shortcut implementation
  • Using the fake, we can connect to the local HTTP server

What it does

  • Instead of connecting to the remote server, it connects to the local server implementation
  • Then it responds to the actual data it receives from the local server.

Difference in using mocks and fakes

  • When we use mocks when the production code changes, we need to make a lot of changes in the test code as well
  • using the fake version, we are separating what from how, we just need to visit the fake code and change the implementation

Most of the time, when we are using a rest API and we want to load test the API, we end up using the fakes

Clone this wiki locally