Test cases generation

AnkrPt Pairwise generates pairwise tests for different needs by using input csv (comma-separated values) files. This lets you easily create different files for different needs. Refer to the section Configuration Files for additional information.

Once you have an input csv file and have installed AnkrPt Pairwise based on the User Installation instructions, you’re ready to generate tests.

There are two ways to generate AnkrPt Pairwise: from the AnkrPt Pairwise folder, or from your configuration file folder. We recommend running from your configuration file folder.

Following it is required to run it with Pairwise with proper parameters.

After the Pairwise process is successfully finished, a file containing generated test suite will be stored in indicated location.

Running Pairwise

  1. Open the folder containing Pairwise.

  2. Double click Pairwise jar to run Pairwise UI.

    ui empty
    Figure 1. User Interface
  3. Provide configuration file with data to Pairwise, use the most efficient way for you to do it:

    • drag and drop file into Pairwise area,

      ui drag and drop2
      Figure 2. Provide input file using drag and drop feature.
    • choose file with file explorer […​],

      ui explorer2
      Figure 3. Provide input file using file explorer.
    • Provide file path into text field.

      ui empty2
      Figure 4. Provide input file path into text field.
  4. Choose folder for output file if you want to save it in different location than input file

    • Provide path into text field or choose folder from file explorer:

      ui output folder2
      Figure 5. Provide output file using file explorer.
  5. Choose custom name for result CSV file

    • Provide custom name into test field.

      ui output file2
      Figure 6. Provide custom filename.
  6. Provide additional setup if needed.

    • You may use custom charset, delimiter and additional output file.

      ui preferences2
      Figure 7. Set custom preferences.
  7. Generate test suite.

    • Hit Generate button or use hotkeys.

      ui generate2
      Figure 8. Generate button.
      ui generate3
      Figure 9. Hotkeys.
  8. Check your results!.

    • Check your result file in output folder or directly with link provided by Pairwise.

      to be added
      Figure 10. Output file link.
  9. Check other UI additional features.

Running Pairwise with terminal

Runtime Parameters

There are several parameters which can be passed into AnkrPt Pairwise to control how test generation works. They are:

Parameter Required Example Description

source

yes

pairwise/abc.csv

source file for the pairwise criteria

output

no

see below

output path or file for the test data to be generated to

delimiter

no

-delimiter=";"

overrides the csv delimiter if your default doesn’t work

charset

no

-charset="UTF-8"

overrides the csv delimiter if your default isn’t sufficient

additionalOutput

no

-additionalOutput="json"

generates additional output file, available formats are json and xml.

Using Pairwise to generate XML files if criteria names don’t meet XML specification requirements may be ineffective and end with getting an XML file that is not parsing (criteria names are converted to XML tags).

XML file still will be generated but will need fixes on the user side.

Output

The optional output parameter can define a relative or absolute file or folder. This is how:

  • If output is not included, the output file has "-output" appended to its name before the extension

  • The system determines relative versus absolute (C: is absolute for Windows, for example)

  • If it has an extension (meaning .csv or similar), it is a file and is written directly to that file. If the file already exists, it will be overwritten.

  • If it is not a file, it is a folder.

    • If it is a relative folder, the relative portion is based on your source file, not the executable path.

    • Tests are written with the same filename as the source filename.

  • If the output file already exists, the new filename includes " (copy 999)" before the extension

Outputing a relative folder keeps generated tests together and your source folder clean.

Refer to: running examples.

Custom Delimiters and charset

Using custom DELIMITERS and various CHARSET for CSV files:

  • running Pairwise from terminal with option -delimiter="[delimiter]" (i.e. -delimiter="|") following parameters allows to execute input CSV file with custom delimiter.

  • running Pairwise from terminal with -charset="[charset]" (i.e. -charset="UTF-8") following parameters allows to execute with allowed charset[i.e. UTF-8 or ISO-8859-1].

  • Fill proper fields (Charset/Delimiter) in Pairwise UI

There are some challenges while working with CSV files that are not created with your locale settings. It may be needed to use combination of delimiter & charset setup to run Pairwise correctly.

Generated Test Suite

As a result of execution of input data, Pairwise returns summary with small statistics, and information, where and with what name output file is saved.

UI after test generation:

UI after test generation

Summary example from Pairwise without UI:
AnkrPt PairWise Processing  for "D:\Pairwise\Constraints.csv"
-----------------------------
Columns         - 6 (1)
  Largest       - 3 (2)
  Smallest      - 2 (3)

Valid Values    - 14 (4)
Negative Values - 8 (5)
Total Pairs     - 78 (6)
Cartesian Count - 144 (7)

Total Tests     - 8 (8)
  Required      - 4    (*** included in total tests) (9)
  Negative      - 5    (*** not included in total tests) (10)

Pairs filtered by constraints: (11)
3-BMW <> 4-Blue
3-BMW <> 4-Red
3-BMW <> 4-Yellow

Test data results saved to 'D:\Pairwise\Results\Constraints.csv'
1 Columns - number of test parameters defined in Criteria.
2 Largest - the largest number of values for parameter defined in Criteria.
3 Smallest - the shortest number of values for parameter defined in Criteria.
4 Valid Values - number of positive values defined for input parameters.
5 Negative Values - number of negative values defined for input parameters.
6 Total Pairs - number of unique pairs of parameter values used in Pairwise algorithm(for positive values only).
7 Cartesian Count - number of test cases that would be generated using all possible parameter combinations(for positive values only).
8 Total Test - total number of positive test cases generated with Pairwise.
9 Required - number of Required test cases generated with Pairwise (Required tests are taken into Pairwise technique).
10 Negative - number of negative test cases generated with Pairwise (Negative tests are not included as a Pairwise technique, their number may be different from number of negative values, if negatives are used in constraints/required tests).
11 Pairs filtered by constraints - set of values not included in generated Test Suite as an effect of Constraints conditions. Numbers before criteria values stands for criteria index (order criteria were defined in Criteria section) to make it easier to identify.

Pairwise generates table with Test Suite, as an output CSV file. Tests with negative value are marked with criteria name of invalid parameter in extra column INVALID CRITERIA USED

output example01
Figure 11. Output file example

You may generate additional output file as Json or XML file.

Using Pairwise to generate XML files if criteria names don’t meet XML specification requirements may be ineffective and end with getting an XML file that is not parsing (criteria names are converted to XML tags).

XML file still will be generated but will need fixes on the user side.

Addition file will be saved in the same location as CSV output file. As it is addition file, it’s older version is not saved and renamed, so it is important to store it in different location.

Json output file example:
[
  {
    "Sale": "Buy",
    "Status": "Used",
    "Vehicle": "Audi",
    "Hours": "Non-working",
    "Color": "Blue",
    "ID": "1",
    "City": "Austin"
  },
  {
    "Sale": "Buy",
    "Status": "Used",
    "Vehicle": "Audi",
    "Hours": "Working",
    "Color": "Blue",
    "ID": "2",
    "City": "Gdansk"
  },
  {
    "Sale": "Sell",
    "Status": "New",
    "Vehicle": "Audi",
    "Hours": "Working",
    "Color": "Red",
    "ID": "3",
    "City": "Gdansk"
  },
  {
    "Sale": "Sell",
    "Status": "New",
    "Vehicle": "BMW",
    "Hours": "Non-working",
    "Color": "Green",
    "INVALID CRITERIA USED": "Color",
    "ID": "4",
    "City": "Gdansk"
  },
  {
    "Sale": "Sell",
    "Status": "Used",
    "Vehicle": "Corvette",
    "Hours": "Working",
    "Color": "Blue",
    "ID": "5",
    "City": "Gdansk"
  },
  {
    "Sale": "Buy",
    "Status": "Used",
    "Vehicle": "Corvette",
    "Hours": "Non-working",
    "Color": "Red",
    "ID": "6",
    "City": "Austin"
  },
  {
    "Sale": "None",
    "Status": "New",
    "Vehicle": "Audi",
    "Hours": "Non-working",
    "Color": "Blue",
    "INVALID CRITERIA USED": "Sale",
    "ID": "7",
    "City": "Austin"
  },
  {
    "Sale": "Buy",
    "Status": "New",
    "Vehicle": "Audi",
    "Hours": "Non-working",
    "Color": "Blue",
    "INVALID CRITERIA USED": "City",
    "ID": "8",
    "City": "Chicago"
  },
  {
    "Sale": "Sell",
    "Status": "Used",
    "Vehicle": "Audi",
    "Hours": "Working",
    "Color": "Yellow",
    "ID": "9",
    "City": "Austin"
  },
  {
    "Sale": "Buy",
    "Status": "New",
    "Vehicle": "Audi",
    "Hours": "Non-working",
    "Color": "Blue",
    "ID": "10",
    "City": "Austin"
  },
  {
    "Sale": "Buy",
    "Status": "New",
    "Vehicle": "Mercedes",
    "Hours": "Non-working",
    "Color": "Blue",
    "INVALID CRITERIA USED": "Vehicle",
    "ID": "11",
    "City": "Austin"
  },
  {
    "Sale": "Buy",
    "Status": "New",
    "Vehicle": "Corvette",
    "Hours": "Non-working",
    "Color": "Yellow",
    "ID": "12",
    "City": "Gdansk"
  },
  {
    "Sale": "Buy",
    "Status": "Used",
    "Vehicle": "BMW",
    "Hours": "Working",
    "Color": "Green",
    "INVALID CRITERIA USED": "Color",
    "ID": "13",
    "City": "Austin"
  }
]
XML output file example:
<List>
    <Test>
        <Sale>Buy</Sale>
        <Status>Used</Status>
        <Vehicle>Audi</Vehicle>
        <Hours>Non-working</Hours>
        <Color>Blue</Color>
        <ID>1</ID>
        <City>Austin</City>
    </Test>
    <Test>
        <Sale>Buy</Sale>
        <Status>Used</Status>
        <Vehicle>Audi</Vehicle>
        <Hours>Working</Hours>
        <Color>Blue</Color>
        <ID>2</ID>
        <City>Gdansk</City>
    </Test>
    <Test>
        <Sale>Sell</Sale>
        <Status>New</Status>
        <Vehicle>Audi</Vehicle>
        <Hours>Working</Hours>
        <Color>Red</Color>
        <ID>3</ID>
        <City>Gdansk</City>
    </Test>
    <Test>
        <Sale>Sell</Sale>
        <Status>New</Status>
        <Vehicle>BMW</Vehicle>
        <Hours>Non-working</Hours>
        <Color>Green</Color>
        <ID>4</ID>
        <City>Gdansk</City>
        <INVALID_CRITERIA_USED>Color</INVALID_CRITERIA_USED>
    </Test>
    <Test>
        <Sale>Sell</Sale>
        <Status>Used</Status>
        <Vehicle>Corvette</Vehicle>
        <Hours>Working</Hours>
        <Color>Blue</Color>
        <ID>5</ID>
        <City>Gdansk</City>
    </Test>
    <Test>
        <Sale>Buy</Sale>
        <Status>Used</Status>
        <Vehicle>Corvette</Vehicle>
        <Hours>Non-working</Hours>
        <Color>Red</Color>
        <ID>6</ID>
        <City>Austin</City>
    </Test>
    <Test>
        <Sale>None</Sale>
        <Status>New</Status>
        <Vehicle>Audi</Vehicle>
        <Hours>Non-working</Hours>
        <Color>Blue</Color>
        <ID>7</ID>
        <City>Austin</City>
        <INVALID_CRITERIA_USED>Sale</INVALID_CRITERIA_USED>
    </Test>
    <Test>
        <Sale>Buy</Sale>
        <Status>New</Status>
        <Vehicle>Audi</Vehicle>
        <Hours>Non-working</Hours>
        <Color>Blue</Color>
        <ID>8</ID>
        <City>Chicago</City>
        <INVALID_CRITERIA_USED>City</INVALID_CRITERIA_USED>
    </Test>
    <Test>
        <Sale>Sell</Sale>
        <Status>Used</Status>
        <Vehicle>Audi</Vehicle>
        <Hours>Working</Hours>
        <Color>Yellow</Color>
        <ID>9</ID>
        <City>Austin</City>
    </Test>
    <Test>
        <Sale>Buy</Sale>
        <Status>New</Status>
        <Vehicle>Audi</Vehicle>
        <Hours>Non-working</Hours>
        <Color>Blue</Color>
        <ID>10</ID>
        <City>Austin</City>
    </Test>
    <Test>
        <Sale>Buy</Sale>
        <Status>New</Status>
        <Vehicle>Mercedes</Vehicle>
        <Hours>Non-working</Hours>
        <Color>Blue</Color>
        <ID>11</ID>
        <City>Austin</City>
        <INVALID_CRITERIA_USED>Vehicle</INVALID_CRITERIA_USED>
    </Test>
    <Test>
        <Sale>Buy</Sale>
        <Status>New</Status>
        <Vehicle>Corvette</Vehicle>
        <Hours>Non-working</Hours>
        <Color>Yellow</Color>
        <ID>12</ID>
        <City>Gdansk</City>
    </Test>
    <Test>
        <Sale>Buy</Sale>
        <Status>Used</Status>
        <Vehicle>BMW</Vehicle>
        <Hours>Working</Hours>
        <Color>Green</Color>
        <ID>13</ID>
        <City>Austin</City>
        <INVALID_CRITERIA_USED>Color</INVALID_CRITERIA_USED>
    </Test>
</List>