Nuclei's products function as marketplaces and mobile banking application services within the bank's ecosystem that makes use of integration of several APIs, In such complex environment of products and services, external dependencies on entities like banks and merchants play a pivotal role. These interactions facilitated through HTTP APIs, are crucial for functionalities such as bill payments, booking platforms, investment services, and numerous other functionalities. In this blog, we discuss the challenges in building a system with third party integrations and a transformative solution using wiremock to overcome them.
While building marketplaces, our development team relies heavily on staging environments provided by third-party entities. While this facilitated the development process, it introduced complexities. The third-party APIs experienced downtime, and certain features or APIs only returned limited responses in the staging environment, limiting the ability to test various scenarios. This situation required a strong solution to simplify development along with enabling thorough testing to ensure an effective workflow.
The Naive Approach
Faced with these challenges, the initial instinct was often to hardcode expected responses from third-party APIs into the application. However, this approach brought about several pain points:
- Code Changes and Deployment Overhead: Updating responses required backend code changes and deployments, introducing unnecessary effort and time.
- Maintenance Challenges: Managing the actual code alongside the hardcoded responses became cumbersome and introduced difficulties in code maintenance.
- Frontend Bottlenecks: Frontend teams were often blocked until backend development was completed. Even if frontend teams resorted to hardcoding, rebuilding for mobile apps became a time-consuming process.
- Test Credential Dependency: Some APIs relied on test credentials, and obtaining additional credentials through communication with third parties was a time-consuming process. Moreover, certain test data could only be used once, posing additional challenges.
While Mockito is a proven unit testing framework, it only helps in writing the unit tests and adding code to pass those unit tests, e2e dev flow can’t be satisfactorily tested. The network brings its own set of surprises.
When we got to know about Wiremock
In the quest for a streamlined solution, we discovered Wiremock, a versatile open-source tool that seamlessly integrates into our development process. Wiremock addresses the challenges faced by us with its unique features:
- Proxy Functionality: Acting as a reliable proxy, Wiremock enables consumer applications to send requests through it, ensuring working API for the ones that are working at the third party’s end, and need not mock these working APIs.
- Mocking Capabilities: Leveraging Wiremock's powerful mocking capabilities, we defined rules to simulate a variety of scenarios/responses, allowing for comprehensive testing without relying on the limitations of third-party staging environments.
Our Staging System
Glance at dashboard
Impact of Wiremock on our development process
The adoption of Wiremock yielded transformative results:
- Development Continuity: our development teams experience a seamless workflow, unhampered by the unavailability of third-party services.
- Enhanced Testing: Wiremock empowered us to test applications under diverse scenarios, even those not supported by third-party staging environments, leading to more robust and reliable software.
- Rapid Frontend Development: Wiremock facilitated frontend development by mimicking APIs during backend development, ensuring frontend teams were unblocked. When actual APIs were ready, Wiremock's mock rules seamlessly transitioned to actual integrations, expediting overall delivery.
- Effortless Rule Updates: Wiremock's GUI dashboard simplified the process of updating rules without the need for deployment, adding an extra layer of efficiency to our development process.
Illustrating an instance where Wiremock made a difference - while developing a few new features, authentication on mobile devices was failing because a dependent third party api was down in staging environment.All the developers were blocked because navigating to most of the functionalities device authentication was required. Wiremock helped bypass the authentication unblocking the development process for the whole team.
Conclusion: A Paradigm Shift in Development Process
Wiremock emerged as a strategic tool, addressing the complexities associated with third-party integrations. By providing a reliable proxy and mock server, Wiremock empowered developers, and accelerated dev testing. For organizations navigating the challenges of third-party dependencies, Wiremock proves to be an invaluable addition to the toolkit, unlocking development potential and supercharging testing efforts. Embrace Wiremock, and witness your projects soar to new heights.