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: tests/e2e_automation/README.md
+45-68Lines changed: 45 additions & 68 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,81 +4,58 @@ This directory contains End-to-end Automation Tests for the Immunisation FHIR AP
4
4
5
5
## Setting up e2e_automation tests to run locally
6
6
7
-
Update README with the changes to use get_token
8
-
9
7
1. Follow the instructions in the root level README.md to setup the [dependencies](../../README.md#environment-setup) and create a [virtual environment](../../README.md#setting-up-a-virtual-environment-with-poetry) for this folder (`e2e_automation`).
8
+
2. Run `poetry install --no-root` to install dependencies.
9
+
3. Ensure you are authenticated with AWS in your terminal, using your preferred method.
10
+
4. Choose which approach you wish to use: static apps or temporary apps. Temporary apps are the recommended way to go as
11
+
they are spun up and torn down on each test run, therefore requiring fewer env vars and less operational overhead. Skip
12
+
to the relevant section below depending on which approach you are going to use.
10
13
11
-
2. Add values to the .env file.
12
-
13
-
For an example of a template .env file, see [.env.example](./.env.example).
**Please contact the Imms FHIR API Test team to get these values.**
30
-
31
-
The following values should be added:
32
-
33
-
```
34
-
username
35
-
scope
36
-
STATUS_API_KEY
37
-
AWS_DOMAIN_NAME
38
-
Postman_Auth_client_Id
39
-
Postman_Auth_client_Secret
40
-
RAVS_client_Id
41
-
RAVS_client_Secret
42
-
MAVIS_client_Id
43
-
MAVIS_client_Secret
44
-
EMIS_client_Id
45
-
EMIS_client_Secret
46
-
SONAR_client_Id
47
-
SONAR_client_Secret
48
-
TPP_client_Id
49
-
TPP_client_Secret
50
-
MEDICUS_client_Id
51
-
MEDICUS_client_Secret
52
-
```
53
-
54
-
4. Run `poetry install --no-root` to install dependencies.
55
-
56
-
5. The `Makefile` in this directory provides the following commands:
14
+
## Setup when using on demand apps
57
15
58
-
- `make test` - run all tests (may take some time)
59
-
- `make test-api-full` - run API tests
60
-
- `make test-api-smoke` - run API smoke tests only (quicker)
61
-
- `make test-batch-full` - run Batch tests
62
-
- `make test-batch-smoke` - run Batch smoke tests only (quicker)
63
-
- `make collect-only` - check that all tests are discovered
16
+
**NOTE:** this approach cannot be used in INT. Both INT and PROD (we do not test here) belong to the APIM Apigee prod
17
+
organisation so there is no support for creating apps on the fly.
64
18
65
-
## Running e2e_automation tests against PR environments
19
+
**Background:** this approach uses the Apigee API to create and teardown applications during a test run. This is the
20
+
approach used in the pipeline for all APIM non-prod environments: internal-dev, internal-qa, pr and so forth.
66
21
67
-
Need to update this in PR and explain how to use static apps if desired locally.
22
+
1. Configure your .env file with the required values.
68
23
69
-
The environment variables define a client ID and client secret for each of the Apigee test apps we use in static
70
-
environments such as `internal-dev`, `internal-qa` and so on.
24
+
The [.env.example.dynamic](./.env.example.dynamic) template defines all the values you will need and explains how
25
+
to obtain them. Most will be simple enough, based on the environment you wish to test. However, there is the
26
+
`STATUS_API_KEY` which you will need to ask the testers or tech lead for, and `APIGEE_ACCESS_TOKEN` which is outlined
27
+
below.
71
28
72
-
However, creating pull requests will spin up a dynamic Apigee proxy and AWS backend which lives for the duration of the PR.
73
-
To minimise admin overhead, the automation tests create dynamic applications for the duration of a test run rather than
74
-
us having to manually create new apps each time we produce a pull request.
29
+
2.[Install](https://docs.apigee.com/api-platform/system-administration/auth-tools#install) and run the Apigee [get_token](https://docs.apigee.com/api-platform/system-administration/using-gettoken) tool to obtain an access token.
30
+
3. Set this value against the `APIGEE_ACCESS_TOKEN` variable in your .env file.
31
+
4. Finally, use the Makefile to run your desired suite of tests.
75
32
76
-
These tests are run seamlessly in the pipeline. But if you are doing some local changes and want to test against your
77
-
PR environment, please follow these pre-requisites to get it working:
33
+
Note: the `get_token` tool is only supported in Linux environments, so if you are using a Windows environment, you will
34
+
at least need to run the operation in WSL to obtain the access token.
78
35
79
-
1. [Install](https://docs.apigee.com/api-platform/system-administration/auth-tools#install) and run the Apigee [get_token](https://docs.apigee.com/api-platform/system-administration/using-gettoken) tool to obtain an access token.
80
-
2. Set this value against the `APIGEE_ACCESS_TOKEN` in your .env file.
81
-
3. Finally, use the [.env.example.pr](./.env.example.pr) as your baseline for your .env file and fill all of the required values.
36
+
## Setup when using static apps
82
37
83
-
Note: the `get_token` tool is only supported in Linux environments, so if you are using a Windows environment, you will
84
-
at least need to run the operation in WSL to obtain the access token.
38
+
**NOTE:** you must use this approach in INT.
39
+
40
+
1. Configure your .env file with the required values.
41
+
42
+
The [.env.example.static](./.env.example.static) template defines all the values you will need and explains how
43
+
to obtain them. A lot more configuration is required as you will need to obtain all the `{Supplier}_client_Id` and
44
+
`{Supplier}_client_Secret` values for the static apps in your target environment.
45
+
46
+
2. Finally, use the Makefile to run your desired suite of tests.
47
+
48
+
## Test commands
49
+
50
+
The `Makefile` in this directory provides the following commands:
51
+
52
+
-`make test` - run all tests (may take some time)
53
+
-`make test-api-full` - run API tests
54
+
-`make test-api-smoke` - run API smoke tests only (quicker)
55
+
-`make test-batch-full` - run Batch tests
56
+
-`make test-batch-smoke` - run Batch smoke tests only (quicker)
57
+
-`make test-sandbox` - run lightweight tests for the sandbox i.e. just checks /\_ping and /\_status
58
+
-`make collect-only` - check that all tests are discovered
59
+
60
+
If you want even more granular control, you can run `poetry run pytest features -m` followed by the given suite you
61
+
want to run e.g. `Delete_Feature`, `Create_Batch_Feature` and so on.
0 commit comments