You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contribute/adr/003_tests_standards.md
+79-4Lines changed: 79 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,21 +2,23 @@
2
2
3
3
## Context and Problem Statement
4
4
5
-
As any application, we want IroCO2 to be reliable throughout time. To that end, tests should be written all along code writing, but those tests should not depend on the person who write code. Thus, definition of standards appears to be mandatory for two reasons :
5
+
As any application, we want IroCO2 to be reliable throughout time. To that end, tests should be written all along code writing, but those tests should not depend on the person who write code. Thus, a definition of standards appears to be mandatory for two reasons :
6
6
- this will facilitate test writing, as well as test reviewing
7
7
- this will ensure the application is resilient, and prevent any regression to be silently implemented
8
8
9
9
The frame we drew with standards to be respected is settled upon two lines of conduct : code coverage as an indicator, and test strategy as a mindset.
10
10
11
+
---
12
+
11
13
## 1. Code coverage
12
14
13
-
The definition of standards around coverage was mainly based on experience and knowledge of the Ippon Technology team in place at the moment of said definition. Nevertheless, online resources can easily be found if you wish to deepen your comprehension of these rules definition (see for example the article ["What is code coverage"](https://www.atlassian.com/continuous-delivery/software-testing/code-coverage))
15
+
The definition of standards around coverage was mainly based on experience and knowledge of the Ippon Technology team in place at the moment of said definition. Nevertheless, online resources can easily be found if you wish to deepen your comprehension of these rules definition (see for example the article ["What is code coverage"](https://www.atlassian.com/continuous-delivery/software-testing/code-coverage)).
14
16
15
17
### Objectives for code coverage by perimeter
16
18
17
19
Since each side of IroCO2 application has its specificities, minimal coverage rate was established project by project.
18
20
19
-
Please keep in mind, in particular for Back-end and Front-end projects, that coverage philosophy of IroCO2 team go beyond quantity of tests, thinking also about quality and pertinence of each test.
21
+
Please keep in mind, in particular for Back-end and Front-end projects, that coverage philosophy of IroCO2 team go beyond quantity of tests, thinking also about **quality** and **pertinence** of each test.
20
22
21
23
| Perimeter | Objective |
22
24
| -------------- | --------- |
@@ -28,6 +30,79 @@ Please keep in mind, in particular for Back-end and Front-end projects, that cov
28
30
>
29
31
> \*\* : *defined without clear idea of necessary time to catch up on that objective, so it can be considered as a minimal*
30
32
33
+
---
34
+
31
35
## 2. Test strategy
32
36
33
-
To be done.
37
+
The main idea behind our test strategy is the Test Pyramid, whose base is made of Unit tests, End-to-end tests at the top, with Integration tests between (see this [pragmatic article](https://martinfowler.com/articles/practical-test-pyramid.html) of Martin Fowler).
38
+
39
+
Still, the concrete strategy must match the reality of the project IroCO2, and moreover it seems necessary to define what we mean with unit tests, integration tests or end-to-end tests, for each perimeter.
40
+
41
+
---
42
+
43
+
### 2.a. Infrastructure
44
+
45
+
For infrastructure perimeter, unit testing and integration testing appear to be difficult. Thus, infrastructure code will mostly be tested with End-to-end tests, focusing on the top of the test pyramid :
46
+
47
+
#### UNIT testing
48
+
49
+
- Definition
50
+
> Testing infrastructure elements
51
+
- Strategy
52
+
> Testing of main elements using for example Terraform Test
53
+
54
+
#### INTEGRATION testing
55
+
56
+
Not applicable
57
+
58
+
#### END-TO-END testing
59
+
- Definition
60
+
> Testing the whole application.
61
+
- Strategy
62
+
> A few tests of use cases, to be executed manually at first, within an AWS sandbox running IroCO2 code. Automation shall be implemented in a second phase.
63
+
64
+
---
65
+
66
+
### 2.b. Back-end
67
+
68
+
#### UNIT testing
69
+
- Definition
70
+
> Testing the classes individually, mocking anything which could be outside its scope.
71
+
- Strategy
72
+
> Our ambition is to test every possible output of every method of every classe. **The coverage with unit tests should never decrease due to a new development**. When possible, it should rise with new unit tests for existing classes with missing test cases.
73
+
> Also, an ambition of IroCO2 team is to produce back-end code with TDD.
74
+
75
+
#### INTEGRATION testing
76
+
- Definition
77
+
> Testing the components in a more complex way. Some (but not all) external behavior are mocked.
78
+
- Strategy
79
+
> For a given use case, several scenarii should be tested, including errors handling.
80
+
81
+
#### END-TO-END testing
82
+
- Definition
83
+
> Testing back-end from endpoints to databases and cloud services without mocking anything.
84
+
- Strategy
85
+
> Each endpoint should be tested through two test cases at least : one testing expected behavior, and one testing error handling
86
+
87
+
---
88
+
89
+
### 2.c. Front-end
90
+
91
+
#### UNIT testing
92
+
- Definition
93
+
> Testing the components individually, mocking what does not depend on its scope.
94
+
- Strategy
95
+
> Our ambition is to test every UI component of the application. **The coverage with unit tests should never decrease due to a new development**. When possible, it should rise with new unit tests for existing components with missing test cases.
96
+
> Also, an ambition of IroCO2 team is to produce front-end code with TDD.
97
+
98
+
#### INTEGRATION testing
99
+
- Definition
100
+
> Testing the components in a more complex way, navigating between components for example
101
+
- Strategy
102
+
> At the moment of the first definition of test strategy, this floor of the Front-end test pyramid is not a priority for IroCO2 team. Anyone is free to init the subject at any moment, beginning with replacing content of this field with the strategy for integration tests.
103
+
104
+
#### END-TO-END testing
105
+
- Definition
106
+
> Testing the whole application.
107
+
- Strategy
108
+
> A few tests of use cases, to be executed manually at first, within an AWS sandbox running IroCO2 code. Automation shall be implemented in a second phase.
0 commit comments