Help Center> CodeArts TestPlan> User Guide> Testing Design> Data Combinations> Creating Test Cases with Data Combinations
Updated on 2024-04-25 GMT+08:00

Creating Test Cases with Data Combinations

Test factors refer to the factors that affect a test, such as the environment, test mode, and test difficulty. The number of test factors of a test is the number of factors that affect the test. By combining these factors, each test case can cover multiple conditions, which helps avoid missing tests.

Selecting Action and Data Factors to Be Combined

During test design, you can add Action Factor, Data Factor, Valid Value, and Invalid Value to mind map nodes.

  • Prerequisites

    You have created a Test Point node, for example, Test the basic functions of a mobile phone. Note that combination can be done only on test points.

  1. Go to the created mind map.
  2. On the top toolbar bar, click on the right of Expected Result. The Action Factor, Data Factor, Valid Value, and Invalid Value tag icons are displayed.
  3. Select the nodes and click the data factor tag icon . Take the node Test the basic mobile phone functions as an example. If the test process is to use a mobile phone to perform {test action} in {connection mode} at {test time}, the data factors can be {test time}, {connection mode}, and {test action} to cover all scenarios for manual testing.

  4. Add a valid or invalid value: Add subnodes to the data factor nodes, select the subnodes, and click the valid value tag icon or the invalid value icon on the toolbar.

    The following figure shows the valid or invalid value subnodes of the data factor nodes Test time, Connection mode, and Test action.

  5. Add an action factor: Select a subnode and click the action factor tag icon on the toolbar. For example, set Test the mobile phone to be an action factor.

  6. Right-click a test point node and choose Generate Combinatorial Case from the shortcut menu.

    The system finds the parent node of the DF nodes and displays their valid and invalid values.

  7. The Generate Combinatorial Case page is displayed, on which action factors are displayed by default.
  8. Click the Data Factor tab, click the Combinatorial Algorithm drop-down list box, and select a combinatorial algorithm. The following table describes the combinatorial algorithms.

    Data Combination Coverage Type

    Description

    All Combinations (AC)

    All values of each test factor are combined. AC is the most comprehensive coverage mode.

    Each Choice (EC)

    Each test factor value appears at least once in any combination.

    Basic Choice (BC)

    Change the value of an input to a BC combination to create a new combination.

    N-wise

    This combination covers N inputs. When N equals the number of parameters, this mode generates AC.

    Tests prove that when N=2 (pair-wise), the generated test data provides the highest efficiency, making this one of the most widely used algorithms.

    After modifying or deleting a data factor node, click Refresh to synchronize modification.

  9. Click Preview Combination.
  10. In the Combination Preview list, select the data combination to be created.

    Move the cursor over the first check box, select Select All Pages or Select Current Page.

  11. Click Next.
  12. On the Configure Test Case page, set the test case name, number, description, and level. The default test case name format is TP node name_${data factor}. Test case numbers will be generated in ascending order based on the set rule.
  13. Write test steps. Use $ to reference data factors.

  14. Click OK.
  15. Click to view the test case list.
  16. The generated test cases are displayed by default. Choose Combination Strategies to view the history of combinatorial algorithms.
  17. Click in the Operation column of the test case to be archived, and click Archive Cases. Other operations:

    • Archive multiple test cases: Select multiple test cases and click Archive Cases.
    • Edit a test case: Click in the Operation column, and view and edit the test case.
    • Delete a test case: Click in the Operation column and click Delete.
    • Delete test cases in batches: Select multiple test cases and click Delete.
    • Search for a test case: Enter a keyword in the search box, and click .
    • Filter test cases: Click the drop-down list box under Test Cases, and select All, Unarchived, or Archived.

  18. On the Archive Case page, select the target test cases on the left. On the right area, select the version, test plan, execution mode, and feature directory, and click Confirm.
  19. In the navigation pane, choose Testing > Testing Case. Select the required version, test plan, and test type tab page, and view the archived test cases.