This project has already been published on PYPI so just follow the tutorial below. In terminal
pip install nwisepy
and then in your python file
from nwisepy import Pairwise
An example python code
from nwisepy import Pairwise
parameters = [['a', 'b', 'c'], [1, 2, 3], [4, 5, 6]]
result = Pairwise(parameters, 2).result()
for idx, value in enumerate(result):
print(f'{idx}: {value}')
and output
0: ['a', 1, 4]
1: ['a', 2, 5]
2: ['a', 3, 6]
3: ['b', 1, 6]
4: ['b', 2, 4]
5: ['b', 3, 5]
6: ['c', 1, 5]
7: ['c', 2, 6]
8: ['c', 3, 4]
Welcome to the Pairwise Testing Algorithm README! This document provides an introduction to the concept of Pairwise testing and its significance in software testing.
Pairwise testing, also known as all-pairs testing or combinatorial testing, is a software testing technique that aims to systematically reduce the number of test cases that need to be executed while still providing thorough coverage. The primary goal is to detect defects that may arise due to interactions between different input parameters.
The Pairwise algorithm generates a set of test cases that covers all possible pairs of input values at least once. By testing combinations of parameters in pairs, the algorithm helps identify potential issues related to the interaction of these parameters without the need to test every possible combination.
- Efficiency: Pairwise testing significantly reduces the number of test cases, making the testing process more efficient while maintaining a high level of coverage.
- Effective Coverage: The algorithm ensures that all possible pairs of input values are tested, helping uncover defects that may be missed with other testing methods.
- Time and Resource Savings: By minimizing the number of test cases, Pairwise testing saves time and resources, making it a cost-effective approach.
Here's a simple example of how Pairwise testing can be implemented in a hypothetical software system using Python:
def generate_pairwise(*parameters): test_cases = [] for i, param1 in enumerate(parameters[0]): for j, param2 in enumerate(parameters[1]): for k, param3 in enumerate(parameters[2]): test_cases.append([param1, param2, param3]) return test_cases # Define input parameters and their possible values parameter1_values = ["A", "B", "C"] parameter2_values = ["X", "Y"] parameter3_values = ["1", "2", "3"] # Generate Pairwise test cases test_cases = generate_pairwise(parameter1_values, parameter2_values, parameter3_values) # Execute test cases for test_case in test_cases: # Perform testing with the combination of input values print(test_case)
http://pairwise.org has details on this testing methododology.