- Tags:: [[Software Testing]] - Date Created: [[2020-09-12]] - Service virtualization is the most sophisticated type of [test double]([[Test doubles]]). It still aims to replace part of a wider network of applications and allow testing to continue on isolated components, but service virtualization is the most complex and realistic type of test double because it replaces entire services. - A virtual service is often created by recording traffic between applications rather than by programmatically defining a series of interactions. For this reason, it is generally easier to initially spin up but also more costly. - "`Service virtualization tools used to create virtual services will most often have user interfaces that allow less tech-savvy software testers to hit the ground running, before diving into the details of how specific protocols work. `" - "`Finally, [some] examples where a virtual service should be considered first: `" - "`If you are a developer working on a very large and complex legacy application that has many dependencies and your current test coverage is very low (e.g. less than 5%)--especially if the system dependencies are unavailable more than two-thirds of the time. A service virtualization tool would allow you to record traffic when the dependencies are available, so that later, you can test using virtual services by replaying the traffic. This limits the impact of downtime of the dependencies for both you and your testers when you let them make use of the virtual services. This is a short term or tactical approach to give you time to create a suite of automated tests for your application that would not use recorded but primed data. How well this can be implemented depends on the nature of the system you are working with. It can be very easy or close to impossible to deliver depending on the details.`" - "`If you are a front end developer working with a public SOAP (Simple Object Access Protocol) like Weather API, take advantage of Sandbox (getsandbox.com) or TrafficParrot (trafficparrot.com) to generate the virtual service using a WSDL file. Set up the test data in the virtual service so that all of your test cases are represented. For example, temperatures below ­-60°C (which are never returned from the real Weather API).`" - "`If you are an NFT (Non-Functional Testing) tester responsible for the performance of a large banking application, use tcpdump to record incoming and outgoing traffic in a production environment for a day. Next import the outgoing traffic using a service virtualization tool and create a virtual service. You can import the incoming traffic to JMeter using tcpreplay and JMeter Proxy. Run a test suite in your performance environment using JMeter and use the virtual services to decouple yourself from other dependencies. Just to be safe, repeat the recording process every week. This could prove to be very easy or very difficult to implement depending on the specifics of the system you are working with. `" - "`Service virtualization can represent much more realistic behavior than simple stubs and mocks. If you can access the dependent application, you can capture its current behavior in a "virtual asset" by recording from the live system. Alternatively, you can model virtual assets that represent the anticipated behavior. You can then configure this virtual asset by parameterizing its conditional behavior, performance criteria, and test data. Moreover, you can easily modify the virtual asset to produce the appropriate assortment of fault conditions, exceptions, etc. that should be exercised in order to validate the full range of system behavior. `" - - [[Test Double Tools]]