Definition

The Parent-Sibling-Primary pattern is a combination of both the Parent-Primary pattern and the Sibling-Primary pattern.

The Primary Domain test data generation is dependent on the Parent Domain test data generation. Each time the Parent Domain completes an iteration of test data generation, the Primary Domain is called to complete one or more iterations of its test data generation with respect to the Parent Domain.

At the same time, the Primary Domain test data generation is also 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 and depends on parent


Parent-Sibling-Primary Patterns

The Primary Domain can have six combinations of test data generation with respect to a combination of both the Parent-Primary pattern and the Sibling-Primary pattern. 
  1. One to One (1-1) Parent-Primary Pattern + One (1) Sibling-Primary Pattern: For each generated record of the Parent Domain, generate exactly one record for the Primary Domain. Before each Primary Domain record is generated, one record from the Sibling Domain is generated.

  2. One to One (1-1) Parent-Primary Pattern + Many (M) Sibling-Primary Pattern: For each generated record of the Parent Domain, generate exactly one record for the Primary Domain. Before each Primary Domain record is generated, one record from each Sibling Domain is generated.

  3. Fixed One to Many (1-N) Parent-Primary Pattern + One (1) Sibling-Primary Pattern: For each generated record of the Parent Domain, generate exactly N records for the Primary Domain where N is a constant greater than 1. Before each Primary Domain record is generated, one record from the Sibling Domain is generated.

  4. Fixed One to Many (1-N) Parent-Primary Pattern + Many (M) Sibling-Primary Pattern: For each generated record of the Parent Domain, generate exactly N records for the Primary Domain where N is a constant greater than 1. Before each Primary Domain record is generated, one record from each Sibling Domain is generated.

  5. Dynamic Zero to Many (0-M) Parent-Primary Pattern  + One (1) Sibling-Primary Pattern: For each generated record of the Parent Domain, generate M records for the Primary Domain where M is a randomly generated number between 0 and N. Before each Primary Domain record is generated, one record from the Sibling Domain is generated.

  6. Dynamic Zero to Many (0-M) Parent-Primary Pattern  + Many (M) Sibling-Primary Pattern: For each generated record of the Parent Domain, generate M records for the Primary Domain where M is a randomly generated number between 0 and N. Before each Primary Domain record is generated, one record from each Sibling Domain is generated.

Parent-Sibling-Primary Pattern Iteration Examples

Pseudo Code Examples

The Pseudo code below shows the six sequences in which test data is generated for the Parent-Sibling-Primary pattern.


One to One (1-1) Parent-Primary Pattern + One Sibling-Primary Pattern

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

 

Fixed One to Many (1-N) Parent-Primary Pattern + One Sibling-Primary Pattern

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

  

Dynamic Zero to Many (0-M) Parent-Primary Pattern + One Sibling-Primary Pattern

for (parentLoop in 1..N) do 
  parent.generateNext() M = randomNumber(0..X)
  while (--M > 0) do
    sibling.generateNext() 
    primary.generateNext()

   

One to One (1-1) Parent-Primary Pattern + Two or More Sibling-Primary Pattern

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

   

Fixed One to Many (1-N) Parent-Primary Pattern  + Two or More Sibling-Primary Pattern

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

   

Dynamic Zero to Many (0-M) Parent-Primary Pattern + Two or More Sibling-Primary Pattern

for (parentLoop in 1..N) do 
 parent.generateNext() 
 M = randomNumber(0..X)
 while (--M > 0) do
   for (index 1..sibling.count) do 
     siblings[index-1].generateNext()  
   primary.generateNext()

   

Concrete Example

The following is a concrete example where the User Domain is the Primary Domain, the Department Domain is the Parent and the Security Level is the Sibling Domain.


Given:

    • There are 3 Departments
    • There are 3 Security Levels (High, Medium & Low)
    • For each Department, there should be 5 Users
    • Each User must be associated to 1 Security Level

    Generated output:

    • Department 1, User 1, Level High
    • Department 1, User 2, Level Medium
    • Department 1, User 3, Level Low
    • Department 1, User 4, Level High
    • Department 1, User 5, Level Medium
    • Department 2, User 6, Level Low
    • Department 2, User 7, Level High
    • Department 2, User 8, Level Medium
    • Department 2, User 9, Level Low
    • Department 2, User 10, Level High
    • Department 3, User 11, Level Medium
    • Department 3, User 12, Level Low
    • Department 3, User 13, Level High
    • Department 3, User 14, Level Medium
    • Department 3, User 15, Level Low