Skip to content

Commit

Permalink
test e2e relations
Browse files Browse the repository at this point in the history
  • Loading branch information
asiermarques committed Nov 19, 2020
1 parent 57de891 commit 5b1bcaf
Show file tree
Hide file tree
Showing 8 changed files with 333 additions and 212 deletions.
4 changes: 2 additions & 2 deletions docs/features/2. create_adr_files.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Feature: create ADR files
And the create command is executed
Then the <filename> ADR file is created
And the adr has an id <id>
And the adr has a <status> status
And the adr has the <status> status
And the adr file content has the <title_in_file> title

Examples:
Expand All @@ -43,7 +43,7 @@ Feature: create ADR files
When the user specify the <title> title
And the create command is executed
Then the <filename> ADR file is created
And the adr has a <status> status
And the adr has the <status> status
And the adr file content has the <title_in_file> title

Examples:
Expand Down
48 changes: 48 additions & 0 deletions docs/features/4. update_the_adr_status.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Feature: update the ADR status

In order easily maintain the ADR files
As an ADR writer
I want to change the status of an ADR file from the command line


Background:

ADRGen allows update the ADR status with the command

adrgen status 1 "accepted"


Scenario: update the ADR status without config to a default valid status

Given there is a 0001-my-architecture-decision.md ADR file with the following content:
"""
---
param1: ""
param2: ""
---
# 1. My architecture decision
Date: {date}
## Status
Status: proposed
## Context
What is the issue that we're seeing that is motivating this decision or change?
## Decision
What is the change that we're proposing and/or doing?
## Consequences
What becomes easier or more difficult to do because of this change?
"""
When the user executes the status command specifying "accepted" for the ADR identified by the 1 id
Then the adr has the accepted status



44 changes: 44 additions & 0 deletions docs/features/5. relation_between_adrs.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Feature: relation link between ADR files

In order to have a clear trace and the evolution of my architecture
As an ADR writer
I want to be able to manager the relations between ADR files

Background:

ADRGen allows creating ADR Files that supersede another one with the command

adrgen create "My ADR file" -s 1

ADRGen allows creating ADR Files that amends another one with the command

adrgen create "My ADR file" -a 1

Given there are the following adrs in the system
| 0001-new-adr.md | accepted | 1 | New adr |
| 0002-new-adr.md | accepted | 2 | New adr |
| 0003-new-adr.md | accepted | 3 | New adr |
| 0004-new-adr.md | accepted | 4 | New adr |

And there is a config file created with this configuration
| default_status | directory | template_file | id_digit_number |
| custom | ./ | ./template.md | 4 |

Scenario Outline: relations between adr files
When the user specify the <title> title
And the user specify the <relation> relation with the target ADR with the <targetADR> id
And the create command is executed
Then the <filename> ADR file is created
And the adr has the <expectedStatus> status
And the adr has the <relation> link on it
And the target ADR has the <relation> relation link on it and the <expectedTargetStatus> status

Examples:
| title | filename | relation | targetADR | expectedStatus | expectedTargetStatus |
| New adr | 0005-new-adr.md | amend | 2 | custom | amended |
| New adr | 0006-new-adr.md | supersede | 2 | custom | superseded |
| New adr | 0007-new-adr.md | amend | 3 | custom | amended |
| New adr | 0008-new-adr.md | amend | 4 | custom | amended |



4 changes: 2 additions & 2 deletions docs/features/features_definition_steps/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package features_definition_steps

import (
"fmt"
"github.com/cucumber/godog"
"os/exec"

"github.com/cucumber/godog"
)

var directory string
Expand All @@ -24,7 +25,6 @@ func SuiteContext(t *godog.TestSuiteContext) {
}
})


t.AfterSuite(func() {
output, err := exec.Command("/bin/sh", "-c", "rm -rf ../e2e").CombinedOutput()
if err != nil {
Expand Down
Loading

0 comments on commit 5b1bcaf

Please sign in to comment.