Use a virtualized service for a UFT One test

Relevant for: GUI tests and API tests

Prerequisite - Deploy the Service Virtualization server

Before you use a virtualization project in a UFT One session, you must do the following: 

  • Start the Service Virtualization Server. For details, see the Service Virtualization User Guide.

  • Confirm trust of the Service Virtualization server's certificate.

    You can confirm the certificate in one of the following ways:

    If UFT One displays a certificate confirmation dialog box when using Service Virtualization, click the confirmation button to trust the certificate.

    If the confirmation dialog box is not displayed, add the Service Virtualization certificate manually to your browser's certificate store, in the list of Trusted Root Certification Authorities.

Back to top

Add services from a virtualization project

  1. Click the ALM Connection down arrow in the UFT One toolbar and select Virtualized Services Settings .

  2. In the Service Virtualization Setup Dialog Box, click the Add Services button.

  3. In the Add New Services dialog box, select the Project radio button and do one of the following:

    • Click Browse and navigate to your virtualization project or virtualization project archive
    • Enter the location of the project in the edit field.

    Note: You can open virtualization projects saved in the file system or in an ALM project.

  4. Click Next.
  5. In the next window, specify the Server address and click Next. If necessary, specify the credentials for accessing your Service Virtualization server.

    UFT One checks that the server is accessible and deployed.

  6. In the next window, select the services to add to the test and click Finish.

    In the main UFT One Service Virtualization dialog box, these services are now listed under the virtualization project name.

  7. In the main Service Virtualization setup dialog box, click Save Setup to add the virtualization project to your UFT One test.

    Note:  

    • You can add multiple virtualization projects to the same test.

    • If you loaded a test or a service from the file system or an ALM project and you lost or changed the ALM connection information, any services and projects are reported as missing when you refresh the test. If you check the deployment of the services, they will still work as intended.

Back to top

Add virtualized services from a server

  1. Click the ALM Connection down arrow in the UFT One toolbar and select Virtualized Services Settings .

  2. In the Virtualized Services Settings Dialog Box, click the Add Services button.

  3. In the Add New Services dialog box, select the Running Server radio button and enter the name of your Service Virtualization server.

  4. In the next window, provide the user name and password for the server.

  5. Click Next.

  6. In the next window, select the services to add to the test and click Finish.

    In the main UFT One Service Virtualization dialog box, these services are now listed under the virtualization project name.

  7. In the main Service Virtualization Setup dialog box, click Save Setup to add the virtualization project to your UFT One test.

    Note: You can add multiple virtualization projects to the same test.

Tip: If a connection error occurs after you add services from a project or server, add the following record to the registry on the SV server machine and then restart the SV server machine:

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319] "SchUseStrongCrypto"=dword:00000001

Back to top

Undeploy a virtualized service

By default, when you add a project or service to your test, it is automatically deployed.

To stop the deployment:

  1. In the Virtualized Services Settings Dialog Box, click the Show Runtime button. The Service Virtualization Runtime dialog box opens

  2. In the Runtime dialog box, select the project you want to deploy.

  3. Click the Undeploy button. UFT One pauses and checks, and removes the project on the server.

    If a project did not deploy correctly, hover over the error indication to see a description of the problem.

Back to top

Update service details (optional)

By default, the service information - including the location of the virtualization project or Service Virtualization server and the credentials required to access the server - is entered when you first add the service.

To update the service details:

  1. In the Virtualized Services Settings Dialog Box, click the parent link for the services that you need to update. The service settings dialog box opens.

  2. In the Service Settings dialog box, update any of the following:

    Service Detail Where? How to update
    Server address and credentials SV Server tab

    In the SV Server tab, enter:

    • The revised Service Virtualization address

    • The revised user name or password for the Service Virtualization server

    Virtualization project details SV Project Location tab

    Enter the path to the project (on the file system or ALM) and the password (if necessary) for the project.

  3. Click Save Configuration to save the details. These revised details are used when UFT One runs the test again.

Back to top

Set the data and performance models

For each of your virtualization projects, you can configure how the service uses data when running the virtualized service. Before running a test using the virtualized service, you need to instruct UFT One which of the associated data models to use:

  1. In the Virtualized Services Settings Dialog Box, select the virtualization project to use for the current test run.

  2. In the Data Model and Performance Model column for each service, from the drop-down list, select the name of the data model and performance model from the drop-down list to use for the current test run.

    UFT One uses the settings specified in the virtualization project for the service's performance and data usage.

Back to top

Pause a deployed service for a test run

By default, all services are deployed when you add them to your test. If you do not want a particular service to run in a specific test run (but you do not want to undeploy the service), you can put it on standby:

  1. In the main Service Virtualization Setup dialog, click the Show Runtime button. The Service Virtualization Runtime dialog box opens.

  2. In the Service Virtualization Runtime dialog, select the services you want to pause.

  3. Above the service list, click the Stop button. UFT One pauses for a moment while it stops the service on the Service Virtualization server.

    Note: To restart the service for a test run, select the service again and click Simulate.

  4. Click Close to return to the main Service Virtualization setup dialog box.

    When UFT One runs the test, it will use the run-time settings for your virtualized services.

Back to top

Put a service on standby

You can put an entire virtualized service on standby, so that it is not available to be used in a test run:

  1. In the Service Virtualization setup window, select the service you want to put on standby.

  2. Above the service list, click Stand-By.

    Note: To restore the service's availability, select the services again and click Simulate.

    UFT One pauses and sets the service to standby mode. The icon next to the service name also changes to a pause symbol.

Back to top

Use the virtualization project in your GUI test

Make sure that your application is configured to use the virtual service address, as specified in the virtualization project. For details on defining virtual service addresses in your virtualization project, see the Service Virtualization User Guide.

Back to top

Use the virtualization project in your API test

When creating your API test steps, you can use the virtualized services in place of calls or requests to real services, including:

  • The URL for your Web Service steps

  • The URL for your REST Service steps

  • The URL for a HTTP Request or SOAP request step

Back to top

Run the test with a virtualized service

After making all necessary changes for your associated virtualization project, run the test by selecting Run > Run or clicking the Run button .

Note: If you deployed a service with the Service Designer in Service Virtualization, you must stop the service simulation in the Service Virtualization Designer window, before running the test that uses the virtualized service. Failure to do so will result in the service being locked for all other users.

When the test runs the step using the virtualized service, it accesses the necessary service as defined in your virtualization project and runs the service.

Back to top