Definition

The Permutation-Primary Pattern is a derivative of the Parent-Primary Pattern in that the Primary Domain's test data generation is dependent on the test data generation of its Parent Domain, Grand Parent Domain and any number of direct Parent Domains in its ancestry. The number of iterations of each parent multiplied together thus, determines the complete number of permutations of the Primary Domain's test data generation for all possible combinations of its direct ancestry. The order of the ancestry is arbitrary, meaning the number of permutations will always be the same irrespective of the order in which the ancestry is traversed.


Object Diagram

KKo6dFNsTEuskUgSwDhSJbx5Khpos6zy-Q.png


Permutation-Primary Pattern

See Parent-Primary Test Data Generation Design Pattern.


Permutation-Primary Pattern Iteration Example

Pseudo Code Example

The Pseudo code below shows a sequence in which test data is generated for the Permutation-Primary patterns having a direct ancestry four levels deep.

     

for (greatGrandParent in 1..N) do
   greatGrandParent.nextGeneration()
   for (grandParent in 1..N) do
      grandParent.generateNext() 
      for (parentLoop in 1..N) do
         parent.generateNext()
         for (primaryLoop in 1..N) do
            primary.generateNext()

 

Concrete Example

The following concrete example where the Primary Domain having a Parent and Sibling Domain, each having their own Parent Domains, must utilize all four Domains to generate a complete permutation of test data.


Object Diagram & Relations Before Permutation-Primary Pattern Applied


qEzRfwAjMivRYJhaxUdsZUg4oViDqFOPxQ.png


Relationships:

  • Brand is the parent of Product
  • Category is the parent of Item
  • Product is the parent of Product Item
  • Item is a sibling of Product Item


Object Diagram & Relations Before Permutation-Primary Pattern Applied


gAdegSYSYKi85gnJbzpuL0QgAac6MWttlA.png


Relationships:

  • Brand is the parent of Product  
  • Product is the parent of Category
  • Category is the parent of Item
  • Item is the parent of Product_Item


Scenario 1
  • if there are 5 Brands
  • and there are 5 Categories
  • and there are 5 Products
  • and there are 5 Items
  • then there will be 625 product_items


Scenario 2
  • if there are 10 Brands
  • and there are 10 Categories
  • and there are 5 Products
  • and there are 5 Items
  • then there will be 2500 product_items

Scenario 3

  • if there are 10 Brands
  • and there are 10 Categories
  • and there are 25 Products
  • and there are 10 Items
  • then there will be 25000 product_items