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 and run tests on the virtualized network. This enables you to view how your network performs while your application is running.

To see a blog post about this, see the UFT 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 on creating network profiles, see the section on managing network profiles in the Network Virtualization for Mobile User Guide.

Back to top

Enter your credentials for accessing the NV Test Manager

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

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 you start a network emulation with the NV.StartEmulation or NV.StartEmulationExcludeIPs methods, the method returns a token with emulation ID.

This token is required to stop the emulation session.

Use the NV.StopEmulation method:

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 specific IP addresses from a network emulation

In your network emulation profile, you can define network conditions for multiple networks. When you run a particular network emulation, you may want to exclude certain networks from the emulation.

You can exclude specific network locations (by IP address) in one of the following ways:

In the Network Virtualization pane of the Options dialog box

In the Excluded IPs section add the IPs to exclude.

These IP addresses are excluded from all network emulation sessions launched from UFT.

Note: The limit on the number of IP addresses to exclude is 200 address.

Using the NV.StartEmulationExcludeIPs method

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

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 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