generated from ministryofjustice/template-repository
/
testing-strategy.html.md.erb
56 lines (40 loc) · 2.45 KB
/
testing-strategy.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
owner_slack: "#modernisation-platform"
title: Testing Strategy
last_reviewed_on: 2023-12-15
review_in: 6 months
---
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-NXTCMQ7ZX6"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-NXTCMQ7ZX6');
</script>
# <%= current_page.data.title %>
## Introduction
We want to test as much of our infrastructure and code as possible. We should endevour to write a test for all new features and changes to existing features.
## Core Platform vs Member testing
This strategy is currently focussed on core platform testing, however members may follow the same principles and use the testing-test environment if they wish.
## Testing tools
We use [Terratest](https://terratest.gruntwork.io/) for testing Terraform code, and [Open Policy Agent (OPA)](https://www.openpolicyagent.org/) for JSON structures.
All other tests should be written in Go and should use the standard Go [testing library](https://pkg.go.dev/testing).
## Testing environments
The AWS account testing-test should be used to run Terratest code into. This account is empty but configured the same as a member account.
When creating a new repo with the `module` type, empty unit tests and workflow will be present to complete.
Run tests locally using the testing-test account Admin SSO credentials.
Tests running in GitHub actions use the `testing-ci` user.
To minimise securty risks around using static credentials, aws keys for `testing-ci` user are automatically rotated every 7 days.
## Testing areas
|Area to test | Type of test | Testing tool | Testing environment | Comments |
|---|---|---|---|---|
|Modules in standalone repositories | Unit test | Terratest | testing-test | |
|Modules in the main repository | Unit test | Terratest | testing-test | |
|Terrafom not in modules | | | | Not currently tested, we should work to move this code into testable modules |
|Environment and networking JSON files | Unit test | OPA | local / Github action ||
|Scripts | | | | Not currently tested, as we rewrite this in Go we should add tests |
| Core platform | Integration test | | | We currently have no such tests |
| Core platform | End to end test | | | We currently have no such tests |
| Core platform | Smoke test || | We currently have no such tests |
| Member infrastructure | All | | testing-test | We currently have no such tests |