Skip to content

Commit 8eeba6d

Browse files
committed
docs: adr test strategy
1 parent a1d7fb1 commit 8eeba6d

File tree

1 file changed

+79
-4
lines changed

1 file changed

+79
-4
lines changed

contribute/adr/003_tests_standards.md

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22

33
## Context and Problem Statement
44

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 :
66
- this will facilitate test writing, as well as test reviewing
77
- this will ensure the application is resilient, and prevent any regression to be silently implemented
88

99
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.
1010

11+
---
12+
1113
## 1. Code coverage
1214

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)).
1416

1517
### Objectives for code coverage by perimeter
1618

1719
Since each side of IroCO2 application has its specificities, minimal coverage rate was established project by project.
1820

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.
2022

2123
| Perimeter | Objective |
2224
| -------------- | --------- |
@@ -28,6 +30,79 @@ Please keep in mind, in particular for Back-end and Front-end projects, that cov
2830
>
2931
> \*\* : *defined without clear idea of necessary time to catch up on that objective, so it can be considered as a minimal*
3032
33+
---
34+
3135
## 2. Test strategy
3236

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

Comments
 (0)