Test - Mock

> Code - (Programming|Computer) Language > Code - Testing (Software Quality Assurance|SQA|Validator|Checker)

1 - About

Mocking is just replacing a function by another function at runtime called a mocking function.

This function overrule the actual implementation of a function during a test.

It permits then to:

  • control the passed parameters
  • return a known value or behavior.

Mock function are generally used to simulate a integration test with third party services such as:

  • a database
  • a rest API
  • a remote server

3 - Framework