Recently, my Broadcom colleague Sankar Natarajan wrote an excellent blog: Turbo-Charging Your Virtual Services by Making Them Data Driven. Sankar’s blog describes how Service Virtualization (SV) can become more powerful by enhancing virtual services with additional data.
This blog on the other hand discusses how we can optimize Test Data Management (TDM) for distributed applications in conjunction with use of service virtualization.
This integrated approach provides multiple benefits, such as simplification of test data management efforts leading to cost and time savings. In addition, it provides all the usual benefits of service virtualization.
In a previous blog I wrote on microservices testing, I discussed challenges posed for TDM by distributed applications, and why Service Virtualization plays a key role in addressing those challenges.
Some of the key challenges we see with implementing TDM alone (without SV) include the following:
In this section we will discuss the key uses for augmenting the use of TDM with SV.
This is one of the most important use cases for use of SV that cannot be solved by using TDM alone, since it is practically impossible to fully test the AUT/CUT that has dependent applications that are unavailable.
SV helps to solve this problem by creating virtual services that stand-in for the unavailable dependent applications (see Figure below). Such virtual services may either be created synthetically (for example from the API specification of an unavailable service using synthetic request-response pairs), or may be recorded from an existing application.
Service Virtualization provides many ways to create simple test data for such virtual services (see the next section) – especially for tests in the CI process. If needed, TDM may be used to create robust test data which can then be injected into the virtual service. TDM is also useful to synchronize test data across multiple dependent services, especially for integration/system tests in the CD process.
SV provides a variety of mechanisms to create test data for virtual services (that stand in for dependent applications) that are less burdensome than creating test data using traditional TDM approaches. These include:
All of these approaches provide a more efficient means to generate test data for dependent applications than using TDM alone – especially for shift-left tests in the CI process. For example, creating a data-rich virtual service typically takes a few minutes, while generating test data sets for dependent applications may take hours (depending on the complexity of the application). In addition, SV provides predictable responses to same request so not have to reset data (between test runs) and can also be used across teams.
Reducing the TDM burden for dependent apps helps focus our TDM efforts on the AUT/CUT, thereby improving test coverage and quality of the AUT.
As before, TDM can be used to inject additional robust data into the virtual services, as well as synchronize of the test data across multiple services. See Figure below.
In the section above, we discussed how SV helps to reduce the TDM burden on dependent apps. As the number of dependencies increase, it becomes more and more difficult to scale the use of traditional TDM techniques. This becomes a key issue in typical microservices architecture -- with hundreds of components with complex dependencies between each other – where agility of delivery is paramount.
SV is a natural fit in the context of development and testing of microservices applications. When coupled with SV, TDM can more easily support the various testing needs of micro-services – unit/component testing, API testing, contract testing, x-services systems testing etc. This integration approach for test data management for microservices testing is described in detail in my earlier blog, so I won’t repeat it here.
Provisioning all the dependent applications (and their accompanying test data) is one of the key challenges in setting up test environments in the CI/CD pipeline. Depending on the size and complexity of these applications, correct test environment setup is often onerous and prone to errors. In addition, deploying large applications consumes significant infrastructure resources despite being able to bede-provisioned on demand. High environment setup time often has an adverse impact on lead time for change.
Use of SV as stand-in for these dependent applications helps to significantly simplify test environments and their setup. Virtual services are a small fraction of the size of applications, and can be packaged into containers (or VMs) for easy deployment.
To adequately meet the needs of different types of tests along the CI/CD lifecycle, the same virtual services can be progressively enriched with robust (and realistic) test data as we move from left to right along the CI/CD pipeline. See Figure below.
By virtue of the fact that data rich virtual services are easier to deploy compared to the full applications they represent in the CI/CD lifecycle, allows us to better automate the pipeline processes. Virtual services provisioning and deployment can be easily and efficiently automated using common CI/CD pipeline management tools – compared to that for real applications, since complex applications often need customized approaches. SV also provides rich APIs for integration with CI/CD engines. This helps to significantly reduce Lead Time for Change.
We mentioned data driven virtual services in the introduction. One of the best ways to create data rich virtual services is by using TDM to generate the data. TDM provides the best mechanism to create robust test data. Data can be generated synthetically or by sub-setting/masking from production, or a combination of both. In addition, TDM can also help to synchronize data across multiple virtual services and test data stores automatically and efficiently.
One of our customers in the financial services industry used SV and TDM together and achieved significant savings. Injecting synchronized test data into virtual services for the dependent applications and test data store (for the AUT) manually proved both slow and erroneous. Using TDM, they were able to not only automate the data generation, but also automate the data injection. This reduced their test data management effort by > 85% and made the process error free.
Other customers have similarly used SV along with TDM for testing against mainframe systems. Mainframe test environments (and their corresponding test data) are difficult and expensive to set up, often resulting in weeks of delays in LTC. Using SV to virtualize the mainframe and injecting test data (from TDM) into the virtual service significantly speeds up the process and cuts down LTC by over 80%.
The following figure summarizes how you can start to integrate use of SV into your TDM implementations.
The key steps of this process includes:
Extending Test Data Manager practices with Service Virtualization practices, can yield significant benefits including decrease in effort, reduction of errors, decrease in Lead Time for Change, and predictability of responses.
TDM and SV complement each other – and hence better together. This is true especially in the context of modern applications such as microservices and when leveraging cloud architectures where the focus is on automation and agility.