How We Achieved 100% Test Coverage and Code Quality For A Leading Technology Company In The Travel Industry
One of our existing client needed to build a mobile app for their business. They are leaders in the online travel industry doing business of over USD 2 billion and selling well over 3 million Hotel rooms annually.
Considering the transformative features in the app, large number of ready consumers, travel agents, internal agents willing to download and use the app from day 1, we were mandated to create a fail proof smartphone app (iOS and Android, NodeJS as backend API server) with 100% test coverage and code. The app was created with an objective of creating a mobile sales and service channel allowing consumers to book their hotels online with a quick sign-in without having to go to hotel’s/company’s website or speaking to any of its agents.
This solution enabled our client to connect with most of its customers, booking agents, travel agencies through a common platform by showcasing the number of services or offerings provided by its partner hotels. Moreover, considering the criticality and scalability of the project, the clients’ management team was willing to invest time and money to meet the desired quality coverage. We decided to go test driven development (TDD) route to automate as much as possible from day one. As well ensure cover for underlying dependencies, cases and inputs, this also helped us keep the codebase clean all the time.
Wanted to highlight some of the things we did:
Test-Driven Development: We have adopted a full test-driven development approach for this project wherein we assured that every code is backed up by a list of automated unit tests which are being run through a series of short development cycles. This is to check if the code is behaving as per our expectation and we are following the right approach to maintain several uncertainties or distractions which are very much expected in such kind of project. When we say we have achieved 100% test coverage in our project, we simply want to redirect your attention to some of the important features such as:
- Proper validation of parameters received from the mobile app to API
- Feature providing the complete list of test cases to verify the code sent from API controller to third party API or vice versa.
- Checking the compatibility of server response with various HTTP status codes like 200, 4x and 5x returned by external servers
For effective test case coverage, we have made use of Istanbul tool to support following use cases and more:
- Transparent coverage of NodeJS unit tests
- Instrumentation/reporting of files in batch mode for browser tests
- Server-side coverage for NodeJS by embedding it as custom middleware
API automation: The app development has been supported by API automation. This is considered as one of the best ways to safeguard your application from all kinds of sudden revisions or modifications in the external APIs. To keep ourselves updated with the changes being done from the third party APIs, it was necessary for us to link our servers with such other servers. With the help of API automation, we have been able to track down every minor change across these servers to take immediate actions/steps whenever needed.
UI automation: Advanced UI automation to provide accessibility features, highly creative designing with sleek navigation patterns, cost-efficient and fast forward solution associated with manual and regression testing and so on.
Continuous Integration & Continuous Development (CI & CD): It’s always a good practice to build out features in isolation and integrating them into each development cycle. With CI & CD, developers can easily figure out several conflicts at the boundaries between new and existing code early. This, in turn, generates a much-needed confidence among the developers which helps them to continue with their work such that the new code honors the requirement of the existing codebase.
The readiness with latest smartphone OS: The app has been developed with a feature to support all the latest OS for android and apple devices.
Code Quality [SonarQube] – We just don’t say rather we proved it!
In order to prove the quality of code, we have made use of SonarQube tool which identifies all the potential bugs/issues in the code post validating it with the highest standard of codes available out there. Using SonarQube, we have been able to manage several leaks in our code through continuous inspection, therefore, maintaining the overall health of our application. Moreover, SonarQube is an open source tool and thus you do not have to spend a penny for it.
Response Optimization: This was actually done to boost the search related query responses in the app. When a user performs any hotel search on this app, there is quick communication between the controller and external API services. We have made every effort to shorten this communication period as short as possible. For this, a code body has been generated that will keep only the required variables (related to hotel search query) in the server such as hotel name, ratings, cost, and location etc. and remove all the unwanted variables. This has greatly optimized the performance of the app with much faster response for the client. Similarly, as our code was dependent on external API, we have also made use of adapter & chain of responsibility design pattern to optimize the entire response through better structuring of our code.
App Security: Not only performance, the app has been built to overcome with every minor security issue out there. As a part of this, we have implemented some great security features in our app such as encryption of data in transit, encryption of data at rest, extra security layer like JailBreak (iOS)/ Rooting (Android), and data backup restriction. We have also made use of JWT based authentication to enable a secure communication network between mobile app and different application servers.
Summing Up: It was imperative for us to create a fail proof product, which meant we had to generate high quality code for a software development project. We have tried to demonstrate how we achieved TDD strategy using Istanbul tool or maintained the code quality using SonarQube.
In case you have any comments or would like to know more about our services, we would love to hear from you. Please comment below!