API Mocking made easy

Create fully mocked APIs quickly—with realistic, randomised data and customisable responses for faster, more reliable testing with fewer blockers

    • Jose Carrera's profile
  • Intermediate
  • 12
  • 12
  • 10
15 already enrolled
What is API mocking and when should you use it?
  • Explain what API mocking is and how it supports testing
  • Recognise common challenges in integration testing that mocking can help mitigate
  • Analyse integration points in a system to identify where mocking an API would be valuable
Getting started with API mocking using Mockoon
  • Install and run Mockoon on your local machine
  • Explore Mockoon’s interface and key features
  • Compare Mockoon to other API mocking tools based on functionality and ease of use
Capturing API requests and creating your first mock responses
  • Set up and run the MERN test application locally
  • Create a mocked endpoint from scratch through the UI
  • Setup a proxy connection from mockoon
  • Mock an endpoint in one click from the application logs
Responding with different status codes
  • Configure mocked responses with different status codes
  • Add multiple responses to an endpoint and define their matching rules
Using random data generation in API responses
  • Use randomised values in an API response
  • Identify and apply different data types using templating helpers in mock responses
Simulating latency with global and per-route response delays
  • Identify scenarios where latency simulation is useful
  • Configure global response delays
  • Configure route-specific delays
Configuring default, random, and sequential response modes
  • Configure a default response for a mocked API
  • Set up random response mode
  • Implement a sequential response mode
  • Enable and disable response rules
Organizing routes and disabling endpoints in Mockoon
  • Organize routes through folders and reordering
  • Toggle routes on and off
  • Perform group actions such as enabling or disabling all routes in a folder
Maintaining and versioning mocked responses with Git
  • Manage your mocked server using version control
  • Identify practices that improve maintainability and collaboration
  • Avoid common pitfalls like large, hard-to-review mock data files.
Automatic mock creation
  • Generate a mocked API from an OpenAPI specification
  • Export your mocked server as an OpenAPI specification
  • Use JSON templates to speed up endpoint mocking
Integrating your mocks with your e2e tests
  • Start the mocked server through Mockoon CLI
  • Execute automated UI checks with the mocked server
  • Configure a GitHub Action to start Mockoon and trigger your UI tests
Your next steps in API mocking
  • Describe when API mocks can be beneficial
  • Identify where mocks fit in your overall test strategy
  • List additional Mockoon features to explore next

Writing reliable and fast UI (E2E) tests can be a challenge, even with advanced testing frameworks. A common pain point is how tests interact with external APIs, which are often slow, unreliable, or flaky. That's where mocking APIs comes in handy.

By mocking specific APIs, we can make our UI tests run smoother and faster. In this course, you’ll learn how to do just that using Mockoon: a free, open-source tool that requires no coding skills and can be set up in minutes.

We'll dive into Mockoon's main features, from the basics to useful options like proxying requests, using variables, and debugging mock environments.

Since no coding is required, you can use Mockoon at various testing levels, from automated UI checks to exploratory testing sessions.

Through hands-on lessons and practical examples, you’ll learn to create realistic and reusable mock APIs that can simplify your testing workflow and speed up feedback loops in your projects.

By the end of this course, you'll be able to:

  • Set up and use Mockoon for mocking APIs at different stages of testing
  • Simulate various API behaviours including delays, status codes, and errors
  • Use dynamic and randomised data in mock responses
  • Integrate mocks into your automated UI tests and CI pipelines
  • Version and maintain your mocks with Git
  • Basic understanding of web applications
  • Access to GitHub and node installed (desired)

 

RiskStorming image
An educational tool to explore Risk Analysis and Quality Strategy building with the whole team.
Explore MoT
Accelerating Test Design: From Chaotic Requirements to Ready-to-Run Test Assets image
Fri, 27 Jun
Automating Manual Test Design with Generative AI
MoT Advanced Certificate in Test Automation image
Ascend to leadership roles by mastering strategic skills in automation strategy creation, planning and execution
Leading with Quality
A one-day educational experience to help business lead with expanding quality engineering and testing practices.
This Week in Testing image
Debrief the week in Testing via a community radio show hosted by Simon Tomes and members of the community
Senior QA Consultant
José Carréra is from Brazil, where he graduated in computer science in 2007 and completed his masters in 2009. Professionally, he has been working on quality related roles since 2006. Moved to the UK in 2015, where currently works as a Senior QA consultant at Ensono Digital.
Subscribe to our newsletter
We'll keep you up to date on all the testing trends.