Select the directory option from the above "Directory" header!

Menu
How service virtualisation improves application testing

How service virtualisation improves application testing

Virtualisation of APIs and application services supports robust and earlier testing, an important part of application modernisation.

Credit: Dreamstime

If you’re developing applications that connect to multiple microservices, software-as-a-service (SaaS) APIs, legacy systems, and other third-party services, creating a robust testing environment can be tricky.

For example, suppose one API you are validating is to a microservice your team developed. In that case, you probably have devops capabilities, including continuous integration and continuous delivery (CI/CD), infrastructure as code, and tools to create test data sets to enable a testing environment for this service.

However, even with these capabilities, it can become costly to spin up multiple testing services when teams develop many cloud-native applications and microservices.

If it’s a third-party API, SaaS, or data stream, you may have to rely on that service’s testing infrastructure and capabilities. Although these test environments should support the production system’s functionality, they may not have a complete data set, and putting them under load to support performance testing may violate the terms of service or be expensive.

Service and API virtualisation platforms aim to address these complexities by creating and simulating API and service endpoints. Instead of spinning up a testing environment, the service virtualisation platform serves as the endpoints for testing downstream applications and composite services, and it responds to a connecting application’s or service’s requests and transactions.

If you’re working with only a few APIs, API mocking may be a good enough practice for simulating endpoints, and tools like Mockito, JMock, or WireMock are Java options. But once you have many development teams, growing APIs, or complex test data sets, a more scalable approach like service virtualisation is needed.

Furthermore, if you are testing apps that process credit cards, connect to bill paying services, or perform other complex transactions, then service virtualisation platforms enable validation against a wider breadth of user experiences and error scenarios.

I spoke with Anna Ramadoss, a cloud engineer in financial services, about using a service virtualisation platform. She says, “Service virtualisation, once mainstream on the teams, thins the line between the main and dependent systems. Updates are immediate, and the delivery timelines get way quicker. The result is a well-crafted system with quicker updates to the market. It can also reduce infrastructure needs and costs.”

How service virtualisation enables shift-left testing

Many organisations are looking to shift-left their testing efforts to identify and resolve issues faster. But what happens when a testing environment isn’t available for dependent services?

It’s natural for developers to circumvent blocks and impediments to their engineering efforts. When developing applications, should the developers wait for an API’s testing infrastructure and capabilities, or are they more likely to push this testing until later in the development process?

Even more problematic, will developers make assumptions on an API’s behaviours and then be forced to resolve defects later in the development process, or worse, when they are found in production?

Instituting a service virtualisation platform and requiring service virtualisation as a development standard has many benefits, especially for teams that require extensive testing capabilities against many APIs. Here are several advantages to using a service virtualisation platform to help shift-left testing:

  • Service virtualisation is a natural extension of developing unit tests and instituting continuous testing for microservices. As part of the development process, developers or quality assurance engineers should configure endpoints in the service virtualisation platform that simulate the API’s responses. All the developers can use these endpoints when building downstream apps and services.
  • Service virtualisation layers simplify testing against multiple versions of an API by exposing endpoints for all supported versions. When testing against new API versions, developers can create tests that compare the responses of the latest version with older ones. This kind of A/B testing can be particularly useful for validating the downstream impacts of new releases of machine learning models and predictive analytics.
  • Service virtualisations can be bundled with test data sets and used to validate transactions. Once developers complete a testing scenario, they can refresh the endpoint back to the original test data set and repeat the testing as needed.
  • When operating on a cloud, service virtualisation platforms can ramp up and down capacity based on testing volume. As a result, the infrastructure can scale to handle many developers running simultaneous tests or more robust performance testing.

By solving a common testing infrastructure challenge, teams can use a service virtualisation platform’s capabilities to institute new testing scenarios earlier in the development process.

Platform providers suggest other use cases. For example, SmartBear recommends that development teams use service virtualisation to enhance security testing, automate different testing scenarios by message types, and support iterative designs.

Parasoft recommends using service virtualisation to test against malformed data responses, simulate high latency, or validate responses to larger payloads. Broadcom Service Virtualisation (formally CA DevTest) advises development teams to chain tests into multistep transactions and continuously validate business workflows.

Ramadoss advises development teams to determine their testing requirements to see if API virtualisation is sufficient, or if the more generalised service validation is required. For example, she says, “Service virtualisation extends to TCP-based protocols to support services from credit bureaus like TransUnion, Equifax, and Experian.” Other protocols that may be needed include database (JDBC), middleware (JMS, Rabbit MQ, and others), and mainframe protocols (CICS and others).

I spoke to Shamim Ahmed, devops CTO at Broadcom, about how devops organisations use service virtualisation in virtual service environments.

He says, “As more organisations evolve to component architectures for their software systems, we see an increasing trend towards adoption of microservices for development and containerisation for deployment. To support this trend, virtual services can be packaged and deployed in containers, instantiated on-demand, and decommissioned when no longer needed.”

How service virtualisation works

Platforms have different capabilities to create service endpoints, and here are the common approaches:

  • Linking or uploading an API’s definition in Web Service Description Language (WSDL), Web Application Description Language (WADL), or OpenAPI Specification (OAS) (Swagger)
  • Recording transactions using browser plug-ins or web server proxies
  • Manually creating service definitions, which can be useful when downstream developers want to test before APIs are ready

After creating endpoints, platforms generally enable connecting to test data sources, uploading test data, or automating test data generation.

Generating test data is very useful when validating forms or document uploads and processing complex transactions. It is also a more secure way to create mock data sets on personally identifiable information (PII) such as names, Social Security numbers, or credit card numbers.

Once there are service endpoints, service virtualisation platforms offer development kits, IDE plug-ins, and CI/CD tool plug-ins as different ways to interface and leverage them. Development teams who target frequent deployments can improve continuous testing practices by having more API endpoints available and increasing the breadth of test data sets.

Agile development teams that use service virtualisation platforms and mature continuous testing practices should consider several best practices, such as creating negative test cases and training the technical staff.

Some best practices for accelerating testing cycles include defining infrastructure requirements, securing virtualised services, and updating systems regularly. Leaders should also seek tangible business benefits such as bringing new applications to production faster and reducing costs.

As more organisations modernise applications for the cloud, develop microservices, and integrate with many SaaS platforms, service virtualisation is a critical platform capability to support robust and continuous testing.


Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags services

Show Comments