Creating multiple tests by using MEP

You can create multiple tests from a Message Exchange Pattern (MEP) in Test Integrations and APIs from the Test Factory view. An operations MEP defines the pattern, schema, and binding for messages that are exchanged by the operation. You can create multiple tests that adhere to the rules defined in the MEP.

Before you begin

You must have completed the following tasks:

About this task

You can create multiple tests in an operation that use the message exchange pattern (MEP) either at the time of synchronizing resources or after you have created and bound the physical resource with the logical one in an operation.

When you create tests you can opt to alter the occurrences of some of the message elements in the Structural Configuration dialog or opt to change the value of the element type in the Contents Configuration dialog.

You can create different tests for each of the content configuration or the variable test data that you set by selecting the Fixed option.

Alternatively, by selecting the Data Driven option, you can create multiple data-driven tests that depend on the structure of the schema defined for the messages and the content combinations that you specify. Either of the following results can occur:
  • A single data-driven test with multiple content iterations is created along with the test data in an Excel worksheet that specifies the values for the iterations which is used at test run time.
  • Multiple data-driven tests with different test structures and content iterations along with the test data in different files that are used by each of the tests during test run time.
The following events apply for data-driven tests:
  • The data-driven tests are created under the Tests folder in the selected operation.
  • A dataset that contains the test data for all the test iterations for each of the data-driven test is created under the Test Data folder in the selected operation.
  • Both the test and the test data are created with the same name and subsequent data-driven tests that are generated in the same operation are suffixed with a number that increases for each successive generation.
  • The physical files of the test and the test data reside in the operation folder of the service component folder of the logical folder in your project directory.

    For example, the location can be as: D:\Projects\Mytest\Logical\HotelFinder.wsc\getHotels.opr\, where HotelFinder.wsc is the name of the service component and getHotels.opr is the name of the operation.

  • When you delete the generated test or the generated dataset in the UI, the corresponding physical file is not deleted from their physical location.

Procedure

  1. Select the operation or folder in which you want to create the tests.
  2. Perform any of the following actions:
    • Right-click the operation or folder and select New > Tests > Tests from the menu.
    • Click the arrow next to the Test icon icon of the test icon in the Test Factory toolbar and select Tests.
    Note: If you created a test already, you can right-click the Tests folder or one of the existing tests, and then select New > Tests.
    The Binding Configuration dialog is displayed, if the operation that contains the tests has a WSDL as its parent.
    Image of the binding configuration dialog.
  3. Select the binding properties for the request and reply messages, and then click Next.

    The Structural Configuration dialog is displayed.

    Image of the Structural Configuration dialog.
  4. Perform the following actions in the Structural Configuration dialog box:
    1. Set the number of occurrences for any message element in the Occurrences column.
      You can enter any number from 0 to n.
      Note: The number of structural tests that are generated depends on the availability of choices in the structure of the underlying schema defined for the message.
    2. Select any of the following options that determines the number of structural tests to be generated:
      Option Results in...
      Every Combination A test is created so that every unique combination of occurrences is satisfied. For example, if one element specifies two occurrences and another specifies three, then six tests are generated because there are six possible combinations.
      Minimum number of combinations At least one unique element is generated in a message for each occurrence, but only enough tests are generated to satisfy the highest single occurrence value. For example, if the greatest number of occurrences entered for any element is three, then three tests are generated.
      Note: This is the default option.
      Include Optional Fields Messages in the generated tests will include all the optional fields that are present under the nodes.
    3. Click Next.

      The Contents Configuration dialog is displayed.

      Image of the Contents configuration dialog.
  5. Perform the following actions in the Contents Configuration dialog box:
    1. Select the value in each message element to generate the test according to the element type. The available types that you can select are described in the following table:
      Type Description
      Random Value Generates a random value according to the element type.
      Note: This is the default value for all elements and is available for all field types.
      Constant Populates the field with the name of the parent element in reverse. If required, this value can be modified.
      Note: This is the value that is available for all field types.
      Random Regex Generates a random value that matches the pattern for every instance of the message field. You can enter a regular expression pattern for the value.
      Note: This is the value that is available for all field types.
      Boundary Generates a value that is on the defined boundary of the field.
      Note: This is the value that is available for numeric field types.
      Beyond Boundary Generates a value that is outside the defined boundary of the field.
      Note: This is the value that is available for numeric field types.
      Iterate Enum Generates a unique test for each enumeration.
      Note: This is the value that is available for fields with enumerated values.
    2. Select any of the following options that determines the number of content combinations in the tests to be generated:
      Option Results in...
      Every Combination Every combination that you specify is selected.
      Minimum number of combinations Uses at least one content combination in the generated test or uses the number of combinations that you specify for any of the message elements.
      Note: This is the default option.
    3. Select any of the following options in the Data Driven panel:
      Option Description
      Fixed
      Tests are generated that are based on the settings set for the content combination. Individual tests are created for each of the content combinations that you specify.
      Note: You must manually set the test data in the generated tests before you run the tests.
      Data Driven

      A single data-driven test is generated based on the content combinations set, with iterations that use the test data. The test data is also generated in an Excel worksheet which is used by the test at run time.

    4. Click Next.
      The Summary dialog is displayed.Image of the Summary dialog.
      You can find the following information that depend on the configurations you set in the previous dialog boxes:
      • The number of structural tests to be generated.
        Note: The number of structural tests to be generated depend on the availability of choices in the structure of the underlying schema.
      • The number of content combinations considered in the tests to be generated.
      • The total number of tests to be generated.
        Note: The number of tests to be generated differ based on the option you select:
        • When the Fixed option is selected, multiple tests are created if different content combinations are specified.
        • When the Data Driven option is selected:
          • A single data-driven test is created if the structural choices in the schema is limited to 1 and you specified different content combinations.
          • A single data-driven test is created for each structural choice that is present in the schema and you specified different content combinations.
  6. Select your action based on the options available in the With Tests panel as described in the following table:
    Option Description
    Do Nothing Creates the tests as displayed in the Statistics panel.
    Note: This is the default option.
    Add to suite Adds the generated tests to an existing test suite that you select by clicking Browse, and then selecting the existing test suite.
    Create new suite Adds the generated tests to a new test suite, which you must name in the Suite field.
    Note: This option is enabled only if there are more than one test to be generated. If a single test is to be generated, you can only add it to an existing test suite and cannot create a new test suite.
    Run suite on Finish Runs the new or existing test suite when the MEP wizard closes.
    Note: This option is enabled if you select either the Add to suite or Create new suite option.
    At the end overwrite the expected messages... Overwrites the expected messages with the messages that are received when the tests are run.
    Note: This option is enabled if all of the following conditions are satisfied:
    • You selected the Fixed option to generate the tests.
    • Alternatively, you selected the Data Driven option and you are able to create multiple data-driven tests with different structural tests, and then opt to add the generated tests to a new test suite.
    • You selected the Run suite on Finish option.
    • You must have configured a database as the Results Database in the Project Settings of your project, and the database is accessible at test run time.
  7. Click Finish to create the tests and return to the Test Factory main view.

Results

The tests are created and named according to the content options that you selected in the wizard. The tests include the appropriate messaging actions as defined by the operations MEP.

What to do next

You can edit the test actions or other contents of the test, if required. See Changing the contents of a test.