Run a test using an emulated network

Relevant for: GUI tests and components

This task describes how to trigger a network emulation session from UFT One and run tests on the virtualized network. This enables you to view how your network performs while your application is running.

Check out the blog on the topic at the All About the Apps blog!

Prerequisites

Before running a test with a virtualized network, you must:

  • Have access to the Network Virtualization Test Manager location.

  • Create the necessary profiles in the NV Test Manager. For details, see the Network Virtualization Help Center.

Back to top

Access the NV Test Manager from UFT One

In the Network Virtualization pane of the Options dialog (Tools > Options > General tab > Network Virtualization node), enter the following:

  • The URL of the NV Test Manager, in the format http://<NV Test Manager Address>:<NV Test Manager Port>

  • User name and password

Select Use Proxy to connect through the proxy set in your Windows Internet Options.

Back to top

Start a network emulation session

In your test or component, add a step to trigger an emulation session start:

NV.StartEmulation("profile name")

The profile name used is taken from the Profiles page in the NV Test Manager.

Back to top

Stop a network emulation

When an network emulation is started using the NV.StartEmulation or NV.StartEmulationExcludeIPs methods, the method returns a token with an emulation ID.

Use this emulation ID to stop the emulation session, using the NV.StopEmulation method.

For example:

token = NV.StartEmulation("profile name")
NV.StopEmulation(token)

Note: You can name the token variable in the example above to any name.

Back to top

Optional - exclude IP addresses from a network emulation

The network conditions in your network emulation profile are defined for multiple networks. However, when running a particular network emulation, you may want to exclude specific networks from that emulation.

When running a specific network emulation, you may want exclude networks (IP addresses) from that emulation. Do so for all sessions using the Options dialog box, or in the step code for a specific test or component:

All sessions

In the Network Visualization pane of the Options dialog box, add IP addresses to exclude from all network emulation sessions launched from UFT One.

Maximum: 200 addresses

A specific session

In your test or component, enter a step using the .Start EmulationExcludeIPs method:

NV.StartEmulationExcludeIPs("profile name", array of excluded IPs)

These IP address are excluded only from the current emulation session.

Back to top

Update an emulation in real-time during a test run

You may want to update the emulation details in real-time conditions to simulate real performance.

Use one of the following methods to update the emulation:

ModifyEmulationDetails

Add a NV.ModifyEmulationDetails method and provide the parameter values:

  • Latency

  • PacketLoss

  • Bandwidth In

  • Bandwidth Out

When the step runs, the currently running emulation is updated according to these parameters and simulated accordingly.

ModifyEmulationProfile

For some Network Virtualization tests, save the emulation details loaded during a test run in your profile.

For these scenarios, add a NV.ModifyEmulationProfile method and specify the profile name.

When the step runs, the currently running emulation is updated according to the details in the specified profile.

StartOrModifyEmulationProfile

This step works the same as the UpdateEmulationFromProfile method, but is used when the test containing the profile is not running in the NV Test Manager.

Insert this step and UFT One starts the test containing the specified profile.

Back to top

Run the test using the network emulation

After you have configured the connection information for the NV Test Manager, and added the necessary statements to your test, run the test.

An icon is displayed in the UFT One status bar to indicate that the network virtualization is started.

In addition, you can see the network emulation running in the NV Test Manager.

In the run results, each emulation Start and Stop step is displayed separately. For full details on the network emulation performance, see your NV Test Manager test results.

Back to top