Creating a datapool associated with a test

You can create datapools that contain variable data for tests to use when they run. This is the preferred way to create a datapool, because the datapool is automatically associated with a test. You can create anything from an empty datapool that contains one column, which you can edit later, to a fully functioning datapool.

Procedure

  1. In the Test Navigator, browse to the test and double-click it. The test opens.
  2. In the Test Contents area, click the name of the test.
  3. In the Common Options tab, click Add Datapool. The options, listed in the following table, enable you to create anything from a simple datapool that you can edit later to a complete datapool.
    To create Do this in the Test Editor - Add Datapool window
    A one-column datapool with a default access mode. In Existing datapools in workspace, select New Datapool<testname>.datapool, and click Finish. You can optionally name the datapool column in this session, and you can add other columns and data later.
    A one-column datapool and choose the access mode. In Existing datapools in workspace, select New Datapool<testname>.datapool, and click Next. You are prompted for the access mode. You can optionally name the datapool column in this session, and you can add other columns and data later.
    An association between the test and an existing datapool. Select the datapool. The datapool is associated with the test, and you can optionally set the access mode in this session.
    A new, fully functioning datapool. Select a project and click Use wizard to create new datapool.
  4. Select the Open mode for the datapool. This mode determines the view that virtual users have of the datapool. Different tests can open the same datapool differently, and you can change the open mode later by opening the test and double-clicking the datapool title.
    Option Description
    Shared (per machine) (default)

    Virtual users on each computer draw datapool values from a shared view of the datapool, with datapool rows apportioned to them collectively in sequential order, on a first-come-first-served basis.

    This option makes it likely that the virtual users or loop iterations will use data from different rows and that the server will see variable data. The exact row access order among all virtual users or iterations cannot be predicted because this order depends on the test execution order and the duration of the test on each computer.

    Private

    Each virtual user draws datapool values from a private view of the datapool, with datapool rows apportioned to each user in sequential order.

    This option ensures that each virtual user gets the same data from the datapool in the same order. Because each user starts with the first row of the datapool and accesses the rows in order, different virtual users will use the same row. The next row of the datapool is used only if you add the test that is using the datapool to a loop in the schedule with multiple iterations.

    Segmented (per machine)

    Virtual users on each computer draw datapool values from a segmented view of the datapool, with data apportioned to them collectively from their segment in sequential order, on a first-come-first-served basis. The segments are computed based on how a schedule apportions virtual users among computers. For example, if a schedule assigns 25% of users to group 1 and 75% to group 2, and assigns these groups to computer 1 and computer 2, the computer 1 view will consist of the first 25% of datapool rows and the computer 2 view will consist of the remaining 75% of rows.

    This option prevents virtual users from selecting duplicate values (for example, account IDs). If you disable wrapping, you cannot use the row more than once.

  5. If you are setting how the test accesses the datapool during this session, select one of the following options. Different tests can access the same datapool differently, and you can change the access mode later by opening the test and double-clicking the datapool title.
    • Sequential: Rows in the datapool are accessed in the order in which they are physically stored in the datapool file, beginning with the first row and ending with the last.
    • Random: Rows in the datapool are accessed in any order, and any given row can be accessed multiple times or not at all. Each row has an equal chance of being selected each time.
    • Shuffled: Before each datapool access, the order of the rows is changed that results in a different sequence. Rows are accessed randomly but all rows must be selected once before a row is selected again.

    The nonsequential access order (Random and Shuffled) is like a shuffled deck of cards. With Random access order, the selected card is returned anywhere in the deck, which means that one card might be selected multiple times before another is selected once. Because you never reach the end of the deck, Wrap when the last row is reached is unavailable. With Shuffled access order, the selected card is returned to the bottom of the deck. After each card has been selected once, you either resume selecting from the top with the same access order (Wrap when the last row is reached is Yes), or no more selections are made (Wrap when the last row is reached is No).

  6. Select one of the following options.
    Option Description
    Wrap when the last row is reached

    By default, when a test reaches the end of a datapool or datapool segment, it reuses the data from the beginning. To force a test to stop at the end of a datapool or segment, clear the Wrap when the last row is reached check box. Forcing a stop might be useful if, for example, a datapool contains 15 records, you run a test with 20 virtual users, and you do not want the last five users to reuse information. Although the test is marked Fail because of the forced stop, the performance data in the test is still valid. However, if reusing datapool data does not matter to your application , the default of wrapping is more convenient. With wrapping, you need not ensure that your datapool is large enough when you change the workload by adding more users or increasing the iteration count in a loop.

    Note: This option is unavailable with the Random option because with random access, there is, in effect, no end of file.
    Fetch only once per user

    By default, one row is retrieved from the datapool for executing each test, and the data in the datapool row is available to the test only for the duration of the test. Select Fetch only once per user to specify that every access of the datapool from any test being run by a particular virtual user will always return the same row.

    To illustrate how these options affect the rows that are returned, assume that a test contains a loop which accesses a datapool. The loop has 2 iterations. The following table shows the row that is accessed in each iteration:
    Datapool option Iteration 1 Iteration 2
    Sequential and Private row 1 row 2
    Shared and Shuffled row x row y
    Fetch only once per user row x row x
  7. If you are creating a fully functioning datapool, you can optionally import the data from a CSV file during this session. You can import data later by clicking File > Import > Test > Datapool, and selecting a CSV file. For more information on importing datapools, see Importing a CSV file into a datapool.

What to do next

After you have created a datapool and added data to it, the next step is to associate a value in the test with a column in the datapool, as discussed in Associating a datapool with the test.
Feedback