Relevant for: GUI tests and API tests
Application testing is usually performed on a real deployment of an application. However, sometimes the service upon which an application is based is unavailable or impractical for repeated use or testing. For example, it is impractical to test a flight booking application which requires the entry of a customer's credit card using the real credit card service run in combination with the application, as each time the test is run, the customer's credit card is charged. In such cases, you can replace your application's service with a virtualized service during testing.
Using Service Virtualization, you create a virtualized service by configuring the behavior of the virtual service to match the expected behavior of the real service. When you are finished creating the service's details in Service Virtualization, the service's details are saved as part of a virtualization project.
Then, in UFT, you add the virtualization project to a test. The project's settings are saved with the test for future testing sessions.
After adding a virtualization project, when designing your test, you use the virtual service address differently for GUI and API tests:
For a GUI test, you insert the service address into your application's code in the function where the application calls the real service.
For an API test, you insert the service's address in place of a URL or service address as a step property.
Then, before running the test containing the virtualized service, you deploy the service on the Service Virtualization Server. Then, when you run your test, the test runs using the virtual service as needed.
For details on creating a virtualization project and virtual services, see the Service Virtualization User Guide.
For task details, see Use a virtualized service for a UFT test.
To learn more, see Assigning data and performance models to a virtualized service.