Distributed Testing Tutorial

Author: AutomatedQA
Last Updated: July 16, 2009
Applies to: TestComplete 7

Introduction

Distributed and non-distributed testing represents a different approach of how to classify testing methods. Non-distributed tests are those that run on a single computer and normally do not interact with other computers.

Distributed tests are different. They consist of two or more parts performed on separate computers that interact with each other. The crucial points of the distributed tests are synchronization, administration and configuration. For better analysis of results, statistics on running of all test parts should be accumulated in a single common result, while you should still keep the ability to analyze individual results of the desired test part.

Distributed testing is applied for testing web sites and server applications when they work with multiple clients simultaneously. The applications of this type are called distributed applications. Testing of a distributed application involves testing its client and server parts. You can always test them separately, but distributed testing gives you a way to test them all together. For instance, a test makes a client instance send requests to the server, at the same time due to several clients working together you can assess how the server performs.

Distributed testing is supported by TestComplete. It provides features for starting tests on several computers in a series or simultaneously, to exchange data during the test run and to control client applications working concurrently by using synchronization points and critical sections.

Distributed Testing in TestComplete

In order to support distributed testing, TestComplete provides you with network suites. The network suite functionality is provided by the Network Suite project item that allows you to create, manage and run tests on different workstations on the network.

The Network Suite item includes elements that let you manage the concurrent run of tests on several network stations. These elements let you configure a list of computers (hosts) that can be engaged in distributed testing controlled by the given project, a list of jobs (a job is a collection of tasks that can be run simultaneously), a list of tasks in each job (a task specifies what project (project suite) should be run on which host) and a list of synchronization points, used to synchronize the execution of projects running on network computers.

To organize a distributed test, two types of projects are used: master and slave. Each of these project types must contain the NetworkSuite item, since a project can participate in a distributed test only if this item is present.

The master project holds all information about a network suite, so it essentially manages your distributed tests. A network suite can include only one master project.

Slave projects contain tests to be run on particular hosts as parts of the distributed test. A network suite can include several slave projects. Slave projects are not downloaded from the master computer to the slave machines. Slave projects must reside on the remote workstations when the test starts.

To perform projects participating in a distributed test in a certain order, you have to synchronize them. TestComplete provides a number of features that synchronize the execution of different distributed test parts. For detailed information about this, see the Synchronizing Distributed Tests article.

Creating a Distributed Test

Suppose we have a physical testing lab or a virtual testing lab with three computers: MasterComputer, SlaveComputer1 and SlaveComputer2. MasterComputer will hold a project that manages the distributed test. SlaveComputer1 and SlaveComputer2 are the remote computers that contain projects that will be run as part of the distributed test. SlaveComputer1 has the following projects: C:\Projects\Project1\Project1.mds and C:\Projects\Project2\Project2.mds. SlaveComputer2 also has two projects located at: C:\My Documents\Project3\Project3.mds and C:\TestComplete\Projects\Project4\Project4.mds.

In our sample, we will explain how to prepare TestComplete projects, how to create jobs and tasks and modify their properties, how to check whether the test will start successfully and how to analyze the results.

Preparing TestComplete Projects for Distributed Testing

Now we will prepare our TestComplete projects that will take part in the distributed test.

First, we will create a new TestComplete project on the MasterComputer. This project will be the master project that manages the distributed test.

To create a new project:

  • If TestComplete is not already running, launch it now. Once it is running, select New | New Project from the TestComplete File menu. This will call the Create New Project dialog. This dialog may function in two modes: Simple and Classic.
    We will use the Simple mode, which is enabled by default. In the dialog, specify the project name, location and VBScript scripting language.

    You can also switch to the Classic mode using the Classic button. It lets you create a new project with the option to specify additional project settings. Also, you can choose any scripting language that you are familiar with; we use VBScript in this example.
  • Click Create to close the dialog.

In order for the project to be able to participate in the distributed test, the project must contain the NetworkSuite item. To add this item to the project:

  • Right-click the project in the Project Explorer panel and choose Add | New Item from the context menu. The Create Project Item dialog will appear.

  • In the dialog, select the Network Suite project item and press OK.

Each computer that takes part in distributed testing must have TestComplete or TestExecute installed, the needed network suite plug-in must be installed in TestComplete (TestExecute) and the NetworkSuite project item must be added to each of the mentioned projects. Make sure that TestComplete or TestExecute is installed on the remote computers and add the NetworkSuite project item to all projects engaged in the distributed test as we have done for the master project: in Project1.mds and Project2.mds on SlaveComputer1 and in Project3.mds and Project4.mds on SlaveComputer2.

Creating the Distributed Testing Hosts list

The NetworkSuite item of the master project contains a list of slave computers for the individual testing tasks that will run.

Let’s add the SlaveComputer1 and SlaveComputer2 hosts to the host list of the network suite:

  • Right-click the NetworkSuite | Hosts project item in the Project Explorer panel and select Add | New Item from the context menu.
  • Specify the name for the new host (SlaveComputer1 or SlaveComputer2) in the subsequent dialog and click OK.
  • Double-click the Hosts node of the NetworkSuite project item. TestComplete will show the Hosts editor in the Workspace panel.
  • Switch to the Hosts editor, click the ellipsis button in the Address column for the new host and select the needed computer from the dialog.
  • Select the SlaveComputer1 host in the host list and specify the C:\Projects string in the Base path column of the Hosts editor. We will use it as a base path for tasks that will run on SlaveComputer1.
    SlaveComputer2 host does not need a base path specified.

The Hosts editor looks like this:

Creating Distributed Testing Jobs and Tasks

After the hosts have been added, we can create jobs and tasks in the master project.

We will create two jobs: Job1 and Job2. To create a new job, right-click the NetworkSuite | Jobs project item in the Project Explorer panel, select Add | New Item from the context menu, assign an appropriate name for the job (Job1 or Job2) in the resulting dialog and click OK.

During the test run, the jobs will be executed one after another in the order they are displayed in the Jobs editor. To view this editor, right-click the NetworkSuite | Jobs node in the Project Explorer panel and then choose Editfrom the context menu:

Each of the created jobs will include two tasks. All tasks of a job will be running simultaneously. Suppose, Job1 will run Project1 on SlaveComputer1 (Task1) and Project3 on SlaveComputer2 (Task2), and Job2 will run Project2 on SlaveComputer1 (Task3) and Project4 on SlaveComputer2 (Task4).

To create a new task in a job, right-click the job in the Project Explorer panel, select Add | New Item from the context menu, assign an appropriate name for the task in the resulting dialog and click OK.

Now let’s modify the tasks properties. To do this:

  • Double-click Task1 in the Project Explorer panel. TestComplete will open the Tasks editor in the Workspace panel.
  • Switch to the editor and specify SlaveComputer1 in the Host column of the Tasks editor.
  • Specify \Project1\Project1.mds in the Path column. We do not specify the full project path because we have specified part of this path in the Base path property of the SlaveComputer1 host. TestComplete will link the Base path and Path values when locating the project (the full projects path will be C:\Projects\Project1\Project1.mds).

  • Repeat these steps to set the following properties of other tasks: Tasks Properties Host Path Task2 SlaveComputer2 C:\My Documents\Project3\Project3.mds Task3 SlaveComputer1 \Project2\Project2.mds Task4 SlaveComputer2 C:\TestComplete\Projects\Project4\Project4.mds

Beside these properties, you can also set other properties in the Tasks editor. For example, depending on the task's Action after run property, the remote host of the task can be shut down, rebooted or left as is after the task run is completed and TestComplete is closed on the remote host. Using the Remote application property, you can specify what testing application, TestComplete or TestExecute, will be used on the remote workstation.

Running the Distributed Test and Analyzing Results

Before we run the distributed test, we can see whether the test will start successfully. To do this, right-click the NetworkSuite node in the Project Explorer panel and select Verify from the context menu. For each enabled task of enabled jobs, TestComplete will check whether the host computers are available, whether TestComplete or TestExecute is installed and can be launched on these computes, whether the project specified by the task’s Path property exists, and other necessary actions.

You can run the network suite as a test item or from a script or a keyword test using the special methods and operations. Using scripts or keyword tests allows the master project to implement more complex logic for executing tasks and jobs. For instance, you can check the job or task state, change the job’s order according to specific conditions and perform other actions. In our case, we need not to create a special script or a keyword test to run the distributed test. We will run the test from TestComplete’s UI. To do this, right-click the NetworkSuite project item of the master project in the Project Explorer panel and select Run from the context menu. During the run, the information about the network suite, job and task execution will be displayed on the Run State page of the NetworkSuite editor:

TestComplete will run the network suite until all of its enabled jobs are completed. Each job, in its turn, runs until all of its enabled tasks are completed. Each job of the network suite coincides with the previous job and will only run after the previous job has finished. Thus, TestComplete will first execute the tasks of Job1, wait for the end of its execution and then run the tasks of Job2. Task1 and Task2 will execute simultaneously as well as Task3 and Task4. After the task run is completed, TestComplete is closed, since this was specified by the Action after run property in the Tasks editor.

After the test is over, we can analyze the distributed test results displayed in the test log:

As you can see, for each task that was launched during the run, the test log keeps an individual log. The task log contains two elements: the log of the task and the log of the test, to which the task refers. The test’s log is displayed as a child node of the task log’s node. To see the contents of task or Test Log, simply select a task run’s log in Log Items.

Conclusion

This introduction to distributed testing shows how TestComplete supports distributed testing and how you can test client-server applications. We hope this information will help you with your distributed testing. For more information about distributed testing, check out our Distributed Testing video. If you are interested in trying TestComplete for free, download and try it today.

 
© 2010 AutomatedQA Corp. All rights reserved.
Home | Privacy | Terms of Use | About | Contact Us | Site Map | Print