Have something to share about Test Automation or WebDriver?
Become a speaker now

Smart Integration Tests with Smart Mocks

Feb 24th

14:00 – 14:45

Stage C

Talk

45 minutes

Russian

Almost all systems actively integrate with external services. Some of these external dependencies are legacy and slow, while some are modern and fast. Problems occur when we want to test our system in an isolated predictable environment. This is very important because in the opposite case, tests become flaky and unreliable causing the effectiveness of testing to decrease very quickly. Therefore, when testing is done with real external dependencies, the following factors could affect it: network issues, slow responses, unexpected failures, data corruption, access issues, etc. This tends to occur more often when external systems are legacy. Every programmer has to face legacy code day after day. It might be ugly, it might look scary, and it has even been known to make a grown man cry. Creating automation testing in cases like these can easily turn your testing into a nightmare.

The first thing that can help is writing stubs for external dependencies and using them for testing purposes. Another problem arises immediately: stubs fix external behaviour and nobody can guarantee that it will remain the same forever, especially if the service is under active development. Because of this, you need not only to have stubs written but also to regularly inspect changes in behaviour and adapt them. These activities significantly increase our development efforts in the testing area. Of course, such stubs should be able to work with legacy SOAP-based systems.

This presentation shows The Smart Stub as one of the solutions to simplify your life and make testing great again. Here are a few scenarios where The Smart Stub can be used. The Smart Stub can be used for local needs and on the CI pipeline as well, allowing for automation of the following activities.

– Running existing tests using The Smart Stub as a proxy to record all request and response pairs.
– Creating flexible matching rules for requests based on recorded data.
– Customizing responses with flexible data replacement rules to ensure they’re always up-to-date.
– Using The Smart Stub in replay mode when all matched requests are processed by The Smart Stub and actualized recorded response is returned. All non-matched requests are passed through and recorded for future usage.
– Recording request and response pairs could be scheduled for comparison to real service in order to detect changes in external behaviour as quickly as possible.

Video
Ihor Herasymenko

Ihor Herasymenko

Senior Software Engineer at EPAM, Ukraine

Senior Java developer at EPAM. Keen on performance testing and CI/CD clarity. Was playing a role of DevOps and key developer on the Smart Stub project.