This page showcases opening the Tracetest Web UI and creating a test against the microservice sample Pokeshop API.
Once you've installed Tracetest, as explained in the installation guide, the Tracetest Agent is running on
4318. You then access the Tracetest Web UI on
app.tracetest.io. Here's what will greet you after a fresh install.
Start the Sample Pokeshop API
To create tests quickly, start the official sample called Pokeshop API.
git clone --depth 1 https://github.com/kubeshop/tracetest.git
This will start an HTTP API on
localhost:8081 and a GRPC API on
Click to view the sample Pokeshop API architecture
Here's the Architecture of the Pokeshop Sample App:
- an API that serves client requests,
- a Worker who deals with background processes.
The communication between the API and Worker is made using a
RabbitMQ queue, and both services emit telemetry data to OpenTelemetry Collector and communicate with a Postgres database.
Tracetest triggers tests against the Node.js API.
Configure the Pokeshop API Demo resource
demo resource to quickly create tests either in the Web UI or with the CLI.
In the Web UI go to Settings > Demo, toggle Enable Pokeshop, and add:
- HTTP Endpoint:
- GRPC Endpoint:
Create a file called
With the CLI, run the command below to enable the
tracetest apply demo -f tracetest-provision.yaml
You can now quickly create tests against the Pokeshop API.
Creating Trace-based Tests
You can create tests in two ways:
- Visually, in the Web UI
- Programmatically, in YAML
Creating Trace-based Tests Visually
This guide will show how to create end-to-end and integration tests in less than 5 minutes via the Web UI.
To view the in-depth guide on creating tests visually, check out this docs page.
On the top right, click the Create button and select Create New Test in the drop down.
Select an HTTP Request as the test trigger, and choose the Pokeshop - Import example.
This will populate a sample API test against a POST endpoint in the Pokeshop app demo. Clicking Create & Run will save and trigger the test.
You'll be redirected to the test page where you can see four tabs and depending on which one you select you'll get access to:
- Test trigger and results.
- The entire distributed trace and trace analysis.
- Test specification and assertions.
- How to automate the test.
To view the in-depth guide on test results, check out this docs page.
The Trigger tab shows how the test was triggered and what the API response was.
The Trace tab shows the entire distributed trace for debugging and a trace analysis score.
The Test tab shows span attributes. Here you add test specs and assertions on attribute values. You also get a test snippets out-of-the-box for common test cases.
In the sample below, you see how to assert that all database spans return in less than
The Automate tab shows how to automate the test run with the Tracetest CLI and other automation options.
From here you can download a YAML file test definition and run it with the CLI.
Creating Trace-based Tests Programatically
The test definition will contain:
- The Trigger for the test in the
- The Test Specifications in the
You can either download the YAML file test definition, or write one from scratch.
Using the sample from above, create the Trace-based Test programatically.
name: Pokemon Import
- key: Content-Type
- selector: span[tracetest.span.type="database"]
name: "All Database Spans: Processing time is less than 100ms"
- attr:tracetest.span.duration < 100ms
- attr:db.system != ""
- selector: span[tracetest.span.type="http"]
name: "All HTTP Spans: Status code is 200"
- attr:http.status_code = 200
Using the CLI, trigger a test run.
tracetest run test -f pokemon-import.yaml --required-gates test-specs --output pretty
The test run will complete and show a result.
✔ Pokemon Import (https://app.tracetest.io/organizations/<org_id>/environments/<env_id>/test/T7-delWIR/run/7/test) - trace id: <trace_id>
✔ All Database Spans: Processing time is less than 100ms
✔ All HTTP Spans: Status code is 200
The provided link in the test output will open the test run in the Tracetest Web UI.