Mocks and Testability

WHEN

-

WHAT

99 Minute Workshop

WHERE

Online

COST

All our 99-minute workshops are included with a Pro membership.

Most of the time, when we develop software, we rely on third-party services to accomplish a certain outcome so that we don’t have to re-invent the wheel. This is where mocks can come in handy.

Topics Ali will cover

We'll explore the following topics

Read full session description ->
  • Identify software integration problems that are solvable with mocks
  • Outline how mocks work in an end to end context
  • Setup a project that uses "mockserver" to replace the integration with a 3rd party system

Meet Your Instructor

Ali Haydar

Ali Haydar

SOFTWARE ENGINEER

A software engineer and lifelong learner. I strongly believe that good software is built through good collaboration and communication, and hence I am a big fan of the DevOps ways of working. I had the opportunities to work in multiple roles in the software industry, starting with testing, development, product/project management. I love technology in general, and enjoy learning about new tools that make the engineers' lives easier.

Google definition of mock is: make a replica or imitation of something. It could be a useful tool that makes testing easier (i.e. increases testability)

-

Mocks and Testability

Ali
99 Minute Workshop
Ali Haydar

Most of the times, when we develop software, we rely on third party services to accomplish a certain outcome so that we don’t have to re-invent the wheel. However, this introduces a new level of complexity, especially around testability.

This where the usage of mocks comes handy. Google definition of mock is: make a replica or imitation of something. It could be a useful tool that makes testing easier (i.e. increases testability).

Mocking isn’t new, and there are lots of articles on the internet about it, but it is less frequent to see content about mocks in the context of a system testing or end to end testing. Usually when creating unit tests, software engineers rely a lot on mocks to mock objects or functions that the unit being tested relies on.

In this workshop, we will be exploring mocks at the end to end level, where we do functional testing of a system that integrates with an external system.

Takeaways

  • Identify software integration problems that are solvable with mocks
  • Outline how mocks work in an end to end context
  • Setup a project that uses "mockserver" to replace the integration with a 3rd party system

Prerequisites

Having the following setup before the workshop would be great, as it will enable us to focus more on the main topic (mocks) and do some discussions about it during the workshop. Please let us know if you face any problems with the setup.

  1. Install Node.js npm
  2. Install the LTS (Recommended for most users).
  3. npm is installed automatically with NodeJS, when you install node you get npm with it.
  4. Verify the installation: node -v
  5. Install ts-node (TypeScript for Node.js):
    • npm install -g typescript
    • npm install -g ts-node
  6. Install Docker - Docker is used to run the mock server, but it can also be installed as a node application too
  7. Install Git
  8. Install vscode or any other code editor you prefer
  9. Register a Marvel account and get your API keys
    • Register here ⇒ menu\join
    • Get your keys here and save both of them. You will need them to get the application running properly when integrated with the real third party system.
    • You will not need your keys once you start with the mocks implementation.
  10. This workshop requires working knowledge of the JavaScript ecosystem. You can check out our Introduction to JavaScript course if you need to get up to speed.

99 Minute Workshops

Short Digestable Live Online Workshops

Live and Instructor-led

All our 99-Minute Workshops are hosted live and led by an instructor.

Short and Targeted

These workshops are a max of two hours long which means they can easy be fit into your busy week. The short time also means they are targeted on a few learning outcomes.

Learn with Others

Connect and learn with other community members during these live online testing workshops.

Available with Pro Membership

All our 99-Minute Workshops are available with Pro Membership, you can attend as many as you like. We also do the odd free workshop with our partners.

All our 99-minute workshops are included with a Pro membership.

Frequently Asked Questions

Are the Workshops Recorded?

Our 99-minute workshpos are designed to be attended live. If you can’t make the scheduled time, it will stay available to replay in CrowdCast for 7 days. To get the most out of them, we highly recommend you attend them live.