-
-
Notifications
You must be signed in to change notification settings - Fork 468
Expand file tree
/
Copy pathe2e_tests.mdc
More file actions
28 lines (18 loc) · 1.75 KB
/
e2e_tests.mdc
File metadata and controls
28 lines (18 loc) · 1.75 KB
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
---
alwaysApply: false
description: Java SDK End to End Tests
---
# Java SDK End to End Tests (System Tests)
The samples in the `sentry-samples` directory are used to run end to end tests against them.
There is a python script (`system-test-runner.py`) that can be used to run one (using `--module SAMPLE_NAME`) or all (using `--all`) system tests.
The script has an interactive mode (`-i`) which allows selection of test setups to execute, whether to run the tests or just prepare infrastructure for testing from IDE.
The tests run a mock Sentry server via `system-test-sentry-server.py`. Any system under test will then have a DSN set that reflects this local mock server like `http://502f25099c204a2fbf4cb16edc5975d1@localhost:8000/0`.
By using this local DSN, the system under test sends events to the local mock server.
The tests can then use `TestHelper` to assert envelopes that were received by the mock server.
`TestHelper` uses HTTP requests to retrieve the JSON payload of the received events and deserialize them back to objects for easier assertion.
Tests can then assert events, transactions, logs etc. similar to how they would appear in `beforeSend` and similar callbacks.
`TestHelper` has a lot of helper methods for asserting, e.g. by span name, log body etc.
The end to end tests either expect the system under test to either be running on a server or call `java -jar` to execute a CLI system under test.
For Spring Boot, we spin up the Spring Boot server. The tests then send requests to that server and assert what is sent to Sentry.
End to end tests are also executed on CI using a matrix build, as defined in `.github/workflows/system-tests-backend.yml`.
Some of the samples are tested in multiple ways, e.g. with OpenTelemetry Agent auto init turned on and off.