---
# System prepended metadata

title: Pairing matrix kata

---

# Pairing matrix kata

As developers, we want to work doing pairing, but we do not want no worry about personal bias or even worry about who is going to be next pairing partner, so we are creating a software that will help us.


## Business rules
- The pair should not repeat the next iteration, unless there is not other option (when there are 2 people, there is not other possible rotation)
- If there is an odd number of developers, we should try to return as many pairs as possible and whenever is not possible create a mob of 3 people. 


## Technical requirements
- The list of developers must not be empty

## Use cases


### Not enough developers has been assigned to the team

Not enough developers assigned to the team - Empty list
```
Scenario: Empty list of developers assigned to the team
  Given no developer has been assigned to the team
  When I request the next pairs arrangement
  Then I should see "At least 2 developers must be assigned to the team"
```

Not enough developers assigned to the team - Only one developer
```
Scenario: Only one developer assigned to the team
  Given only one developer has been assigned to the team
  When I request the next pairs arrangement
  Then I should see "At least 2 developers must be assigned to the team"
```

### A team of only 2 people

```
Feature: Pairing matrix for a team of only 2 people

  Scenario: Generate pair arrangements for a team of 2 developers
    Given the following list of developer assigned to the team
    | Name            |
    |-----------------|
    | Dianne Major    |
    | Lachlan Martin  |
    When I request the next pairs arrangement
    Then I should see the following team arrangement
    | Team arrangement             | Type of rotation | Times of this rotation |
    |-----------------------------|------------------|------------------------|
    | Dianne Major - Lachlan Martin| Pair             | 1                      |
    When I request the next pairs arrangement
    Then I should see the following team arrangement
    | Team arrangement             | Type of rotation | Times of this rotation |
    |-----------------------------|------------------|------------------------|
    | Dianne Major - Lachlan Martin| Pair             | 2                      |
    When I request the next pairs arrangement
    Then I should see the following team arrangement
    | Team arrangement             | Type of rotation | Times of this rotation |
    |-----------------------------|------------------|------------------------|
    | Dianne Major - Lachlan Martin| Pair             | 3                      |

```

### A team of only 3 people

```
Feature: Pair/mob rotation for a team of 3 developers

  Scenario: Generate pair/mob rotation for a team of 3 developers
    Given the following list of developer assigned to the team
      | Name             |
      |------------------|
      | Dianne Major     |
      | Lachlan Martin   |
      | Declan Chandler  |
    When I request the next pairs arrangement
    Then I should see the following team arrangement:
      | Team arrangement                          | Type of rotation | Times of this rotation |
      |-------------------------------------------|------------------|------------------------|
      | Lachlan Martin - Krista Cowan - Declan Chandler | Mob              | 1                      |
    When I request the next pairs arrangement
    Then I should see the following team arrangement:
      | Team arrangement                          | Type of rotation | Times of this rotation |
      |-------------------------------------------|------------------|------------------------|
      | Lachlan Martin - Krista Cowan - Declan Chandler | Mob              | 2                      |
    When I request the next pairs arrangement
    Then I should see the following team arrangement:
      | Team arrangement                          | Type of rotation | Times of this rotation |
      |-------------------------------------------|------------------|------------------------|
      | Lachlan Martin - Krista Cowan - Declan Chandler | Mob              | 3                      |

```

### Odd amount of pairs


```
Feature: Generate team arrangement with odd number of developers

  Scenario: Generate team arrangement for odd number of developers
    Given the following list of developer assigned to the team
      | Name              |
      | Dianne Major      |
      | Lachlan Martin    |
      | Declan Chandler   |
      | Krista Cowan      |
      | Ivy-Rose Howells  |
    When I request the next pairs arrangement
    Then I should see the following team arrangement
      | Team arrangement                              | Type of rotation | Times of this rotation |
      | Dianne Major - Lachlan Martin                  | Pair             | 1                      |
      | Declan Chandler - Krista Cowan - Ivy-Rose Howells | Mob              | 1                      |
```

### Even amount of pairs on the team rotation

```
Given the following list of developer assigned to the team
|        Name      |
|------------------|
| Dianne Major     |
| Lachlan Martin   |
| Declan Chandler  |
| Krista Cowan     |
| Ivy-Rose Howells |
| Cassidy Donald   |

When I request the next pairs arrangement
Then I should see
|         Team arrangement          | Type of rotation | Times of this rotation |
|-----------------------------------|------------------|------------------------|
| Dianne Major - Lachlan Martin     | Pair             | 1                      |
| Declan Chandler - Krista Cowan    | Pair             | 1                      |
| Ivy-Rose Howells - Cassidy Donald | Pair             | 1                      |

When I request the next pairs arrangement
Then I should see
|         Team arrangement          | Type of rotation | Times of this rotation |
|-----------------------------------|------------------|------------------------|
| Dianne Major - Ivy-Rose Howells   | Pair             | 1                      |
| Declan Chandler - Cassidy Donald  | Pair             | 1                      |
| Dianne Major - Cassidy Donald     | Pair             | 1                      |

When I request the next pairs arrangement
Then I should see
|         Team arrangement          | Type of rotation | Times of this rotation |
|-----------------------------------|------------------|------------------------|
| Lachlan Martin - Ivy-Rose Howells | Pair             | 1                      |
| Declan Chandler - Krista Cowan    | Pair             | 1                      |
| Lachlan Martin - Cassidy Donald   | Pair             | 1                      |

When I request the next pairs arrangement
Then I should see
|         Team arrangement          | Type of rotation | Times of this rotation |
|-----------------------------------|------------------|------------------------|
| Dianne Major - Ivy-Rose Howells   | Pair             | 2                      |
| Declan Chandler - Cassidy Donald  | Pair             | 2                      |
| Dianne Major - Cassidy Donald     | Pair             | 2                      |

```

### Odd amount of pairs on the team


```
Given the following list of developer assigned to the team
|        Name      |
|------------------|
| Dianne Major     |
| Lachlan Martin   |
| Declan Chandler  |
| Krista Cowan     |
| Ivy-Rose Howells |
When I request the next pairs arrangement
Then I should see
|                 Team arrangement                  | Type of rotation | Times of this roration |
|---------------------------------------------------|------------------|------------------------|
| Dianne Major - Declan Chandler                   | Pair             | 1                      |
| Lachlan Martin - Krista Cowan - Ivy-Rose Howells  | Mob              | 1                      |
When I request the next pairs arrangement
Then I should see
|                 Team arrangement                  | Type of rotation | Times of this roration |
|---------------------------------------------------|------------------|------------------------|
| Dianne Major - Krista Cowan                       | Pair             | 1                      |
| Lachlan Martin - Declan Chandler - Ivy-Rose Howells| Mob              | 1                      |
When I request the next pairs arrangement
Then I should see
|                 Team arrangement                  | Type of rotation | Times of this roration |
|---------------------------------------------------|------------------|------------------------|
| Dianne Major - Ivy-Rose Howells                   | Pair             | 1                      |
| Lachlan Martin - Krista Cowan - Declan Chandler   | Mob              | 1                      |
When I request the next pairs arrangement
Then I should see
|                 Team arrangement                  | Type of rotation | Times of this roration |
|---------------------------------------------------|------------------|------------------------|
| Krista Cowan - Declan Chandler                    | Pair             | 1                      |
| Dianne Major - Lachlan Martin - Ivy-Rose Howells  | Mob              | 1                      |
When I request the next pairs arrangement
Then I should see
|                 Team arrangement                  | Type of rotation | Times of this roration |
|---------------------------------------------------|------------------|------------------------|
| Dianne Major - Ivy-Rose Howells                   | Pair             | 2                      |
| Lachlan Martin - Krista Cowan - Declan Chandler   | Mob              | 2                      |
```