Definition

The Sibling-Primary pattern should be used when the Primary Domain does not need a Parent Domain but has one or more Parent Domains that should be referenced as Sibling Domains. The Primary Domain test data generation is dependent on its Sibling Domain’s test data generation. Each Sibling Domain completes one iteration of test data generation before the Primary Domain completes one or more iterations of its test data generation.


Object Diagram

Primary depends on sibling or depends on siblings.png


Sibling-Primary Patterns

The Primary Domain can have two possible test data generation patterns with respect to a Sibling or Siblings:

  1. One (1) Sibling-Primary Pattern: Before each Primary Domain record is generated, one record from the Sibling Domain is generated.

  2. Many (M) Sibling-Primary Pattern: Before each Primary Domain record is generated, one record from each Sibling Domain is generated.

Sibling-Primary Patterns Iteration Examples

Pseudo Code Examples
The Pseudo code below shows the sequence in which test data is generated for the different Sibling-Primary patterns.

One Sibling-Primary Pattern

for (primaryLoop in 1..N) do
  sibling.generateNext()
  primary.generateNext()

 

Two or More Sibling-Primary Pattern

for (primaryLoop in 1..N) do
  for (index 1..sibling.count) do
    siblings[index-1].generateNext()   
  primary.generateNext()

Concrete Examples

The following are concrete examples where the Order Domain is the Primary Domain and Shipping Vendor and Package Size are Sibling Domains.

One Sibling-Primary Pattern

Each Order must be associated a Shipping Vendor

  • There are three types of Shipping Vendors, generated in sequential order
    • UPS
    • FedEx
    • USPS
  • If there are 5 Orders, the results would be the following:
    • Order 1, UPS
    • Order 2, FedEx
    • Order 3, USPS
    • Order 4, UPS
    •  Order 5, FedEx

One Sibling-Primary Pattern

Each Order must be associated a Shipping Vendor

  • There are three types of Shipping Vendors, generated in sequential order 
    • UPS
    • FedEx
    • USPS
  • If there are 5 Orders, the results would be the following:
    • Order 1, UPS
    • Order 2, FedEx
    • Order 3, USPS
    • Order 4, UPS
    • Order 5, FedEx

M Sibling-Primary Pattern

Each Order must be associated a Shipping Vendor and a Package Size

  • There are three types of Shipping Vendors, generated in sequential order 
    • UPS
    • FedEx
    • USPS
  • There are two Package Sizes, generated in sequential order
    • Small
    • Large
  • If there are 5 Orders, the results would be the following:
    • Order 1, UPS, Small
    • Order 2, FedEx, Large
    • Order 3, USPS, Small
    • Order 4, UPS, Large
    • Order 5, FedEx, Small