Whenever you are developing web applications involving 3rd party services or websites, testing them becomes very difficult because of external dependencies. These external services or websites may change without notice, suffer from downtime, or otherwise become temporarily inaccessible, as the internet is not 100 percent reliable. If one the test cases depends on the communication with a third-party website, the cause of failure of that test case will become hard to pinpoint.
To solve this issue, there is a tool called Betamax which works by intercepting HTTP connections initiated by a web application, and then later replaying them. Betamax has some shortcomings. It requires an internet connection. Also, it doesn’t support using authentication protocols, such as OAuth and OpenId. To solve these issues, LinkedIn team has developed their own internet mocking tool based on Betamax, called Flashback.
- Flashback is designed to mock HTTP and HTTPS resources, like web services and REST APIs, for testing purposes. It records HTTP/HTTPS requests and plays back a previously recorded HTTP transaction—which we call a “scene”—so that no external connection to the internet is required in order to complete testing.
- Flashback can also replay scenes based on partial matching of requests. It does so using “match rules.” A match rule associates an incoming request with a previously-recorded request, which is then used to generate a response.
LinkedIn has also announced that they are open-sourcing Flashback and it now available under a BSD two-clause license. You can learn more about how this tool actually works here.