Go Beyond Stubbing and Mocking: Discover Service Virtualization - Part 2
May 09, 2023

Adam Attanasio
Parasoft

Service virtualization (SV) is a method that DevOps teams use to simulate components of an app's behavior. Using SV saves time, money, headache, and frustration. DevOps teams don't end up with an "us vs. them" attitude when development grinds to a halt while waiting for their fellow team members to complete their part of it.

Start with: Go Beyond Stubbing and Mocking: Discover Service Virtualization - Part 1

Test Environments: Real Vs. Virtual

As a developer, you need to produce working software. The software components often have to integrate or interact with other software. Application testing often happens in a production environment, which may present risks and cause delays.

When developing software, you want the application to be as ready as possible before exposing it to the real world. In production, the software needs to be able to deal with many different scenarios, which we can prepare for using a virtual test environment that mimics the actual system. 

When designing the software to handle all expected situations and to be capable of managing unexpected ones, you need to address multiple potential circumstances.

■ What happens if you put tremendous pressure on the software?

■ What if one of the components becomes incapacitated?

■ Will you still be able to achieve the defined goals if something unexpected happens?

By taking control over your test conditions with a virtual test environment, you make it easier to fully test and verify your application's tasks and ensure that it meets the necessary standards for deployment. This results in lower costs, higher productivity, and faster delivery to production.

Automating Load and Performance Testing

Performance testing in the form of load testing, scalability, and stress testing is already a core quality practice, but for many teams, it's largely limited to manual ad hoc tests that get "kicked off" when the system and environment are configured for testing. The goal is to get as close to production levels as possible, but it all also means a significantly longer feedback loop.

Continuous load testing is a type of software development testing that involves subjecting a computer system, network, or web application to a continuous stream of load or traffic to determine how it performs under sustained use. The purpose of continuous load testing is to identify and fix performance issues early before they balloon and impact users or customers.

Continuous load and performance testing are often used together to continuously monitor and improve the performance and stability of a system or application. This can involve automating the testing process and integrating it into the development and deployment pipelines so that the system or application is tested at various stages of its life cycle.

Modern performance testing introduces new principles driven by test automation. Service virtualization makes it possible for you to establish a reusable test environment that can be reset to a known state so that different load and performance testing conditions can be executed and evaluated.

Service Virtualization Examples

Example 1. Your team is working on a large, complex legacy app with many dependencies. The present test coverage is low, in particular when the system dependencies are consistently not available.

Service virtualization enables you to log traffic when the dependencies become available. As a result, the team can later test with virtual services if you replay the traffic. This reduces the impact of the dependencies' downtime for the team and the testers.

Example 2. Your team is working in a microservices-type architecture. One department has 10 testers and 20 developers. The group is in charge of delivering 70 small apps, which form a product.

Working teams test the applications individually and in isolation. While your team's CI/CD system works well, the outside environment is not agile. Their APIs are slow and are often not available, which makes it difficult to set up test data.

To solve the issue, each team that interfaces with the third parties uses SV tools, and the acceptance testers use them during the CI build. The developers also use them for manual exploratory tests. The team then uses the tools in the primary integration build which runs all the applications. Finally, the performance test teams use the SV tools in the full stack performance tests.

The Benefits and Challenges of Service Virtualization

The many benefits of using service virtualization include:

■ Establishes a commonality so development teams can communicate with their fellow development and test teams and share artifacts. Teams also can readily exchange SV assets within the company.

■ Easy to learn, even for non-IT people, so developers can continue their work while testers use SV to test all aspects of a project, with the resulting reduction in labor costs.

■ Supports many protocols and can record traffic for them. Ideally, these traffic recordings can be used to automatically generate virtual assets.

■ Reduces dependence on the availability of third-party components and there are no service charges for third-party databases, APIs, or services.

■ Reduces time to market because SV lessens testing, and therefore, development time.

■ Increases quality because testing is more thorough and accurate.

Some people say using service virtualization presents too many challenges. The right tool can provides solutions.

Challenge: "As opposed to testers or developers creating a stub or mock to test the project, don't SV tools cost more?"

Solution: Not using SV complicates testing and adds to expenses. Having a virtual asset that accurately behaves and responds like the actual downstream service can accelerate testing and reduce costs, rapidly offsetting any tool investment expense.

Challenge: "SV systems are large and may not be right for my small company."

Solution: Smaller organizations can see big benefits from service virtualization, since it can save both time and money for testing complex applications and distributed systems. Deploy only what you need to get started and scale up as you grow.

Challenge: "To avoid a poor user experience, how can my company make sure the service virtualization package I choose is right for my needs?"

Solution: Review the aspects to consider for selecting the right service virtualization tool for your company's requirements in this whitepaper.

Summary

Better than mocks and stubs, service virtualization serves your company well because it enables continuous testing, it's more sharable, and it's reusable. When added to your CI/CD workflow, SV reduces costs and shortens the time to market. You can increase your confidence that applications meet your business goals and technical requirements when you control your test data and environment.

Learn more about how companies deploy service virtualization as part of their software testing strategies at the Automated Software Testing & Quality Summit, hosted by Parasoft on May 16.


Adam Attanasio is a Product Manager at Parasoft
Share this

Industry News

May 01, 2024

Amazon Web Services (AWS) announced the general availability of Amazon Q, a generative artificial intelligence (AI)-powered assistant for accelerating software development and leveraging companies’ internal data.

May 01, 2024

Red Hat announced the general availability of Red Hat Enterprise Linux 9.4, the latest version of the enterprise Linux platform.

May 01, 2024

ActiveState unveiled Get Current, Stay Current (GCSC) – a continuous code refactoring service that deals with breaking changes so enterprises can stay current with the pace of open source.

May 01, 2024

Lineaje released Open-Source Manager (OSM), a solution to bring transparency to open-source software components in applications and proactively manage and mitigate associated risks.

May 01, 2024

Synopsys announced the availability of Polaris Assist, an AI-powered application security assistant on the Synopsys Polaris Software Integrity Platform®.

April 30, 2024

Backslash Security announced the findings of its GPT-4 developer simulation exercise, designed and conducted by the Backslash Research Team, to identify security issues associated with LLM-generated code. The Backslash platform offers several core capabilities that address growing security concerns around AI-generated code, including open source code reachability analysis and phantom package visibility capabilities.

April 30, 2024

Azul announced that Azul Intelligence Cloud, Azul’s cloud analytics solution -- which provides actionable intelligence from production Java runtime data to dramatically boost developer productivity -- now supports Oracle JDK and any OpenJDK-based JVM (Java Virtual Machine) from any vendor or distribution.

April 30, 2024

F5 announced new security offerings: F5 Distributed Cloud Services Web Application Scanning, BIG-IP Next Web Application Firewall (WAF), and NGINX App Protect for open source deployments.

April 29, 2024

Code Intelligence announced a new feature to CI Sense, a scalable fuzzing platform for continuous testing.

April 29, 2024

WSO2 is adding new capabilities for WSO2 API Manager, WSO2 API Platform for Kubernetes (WSO2 APK), and WSO2 Micro Integrator.

April 29, 2024

OpenText™ announced a solution to long-standing open source intake challenges, OpenText Debricked Open Source Select.

April 29, 2024

ThreatX has extended its Runtime API and Application Protection (RAAP) offering to provide always-active API security from development to runtime, spanning vulnerability detection at Dev phase to protection at SecOps phase of the software lifecycle.

April 29, 2024

Canonical announced the release of Ubuntu 24.04 LTS, codenamed “Noble Numbat.”

April 25, 2024

JFrog announced a new machine learning (ML) lifecycle integration between JFrog Artifactory and MLflow, an open source software platform originally developed by Databricks.

April 25, 2024

Copado announced the general availability of Test Copilot, the AI-powered test creation assistant.