Performance Testing with Distributed Tracing using Artillery, Playwright and Tracetest
Find out the requirements for your instrumented app to start using Tracetest x Playwright.
This integration is compatible with Artillery v2.0.10 and above.
Tracetest is a testing tool based on OpenTelemetry that permits you to test your distributed application. It allows you to use the trace data generated by your OpenTelemetry tools to check and assert if your application has the desired behavior defined by your test definitions.
Playwright is an open-source automation framework developed by Microsoft that enables cross-browser automation for web applications. It provides a set of APIs and libraries for automating interactions with web browsers such as Chrome, Firefox, and Microsoft Edge.
Artillery is a modern, powerful load-testing toolkit. Artillery is designed to help developers and testers simulate traffic to their applications, APIs, and microservices. It allows users to define scenarios to test how their systems behave under different loads.
Why is this important?​
The Tracetest integration for Playwright enables your current Playwright tests to easily capture a full distributed trace from your OpenTelemetry instrumented front-end and back-end system.
You can embed a Tracetest test in this Playwright test, and allow trace-based testing assertions to be applied across this entire flow, enabling true end-to-end tests across your entire system. Taking it a step further you can use the Playwright engine in Artillery to run performance tests on top if it.
Because you're using traces as test specs you can:
- Get faster MTTR for failing performance tests
- Assert against the Artillery test execution, Playwright test execution, and the system under test
- Validate functionality of other parts of your system that may be broken, even when performance tests are passing
The @tracetest/playwright
npm Package​
The @tracetest/playwright
npm package is a Playwright plugin that allows you to run trace-based testing using Tracetest and Playwright. It is a wrapper around the Tracetest API that allows you to configure, orchestrate and run tests from Playwright.
The Artillery Playwright Engine​
The artillery-engine-playwright
npm package is an Artillery engine lets you combine Playwright with Artillery to launch real browsers for full browser load testing.
Requirements​
Tracetest Account:
- Sign up to
app.tracetest.io
or follow the get started docs. - Have access to the environment's agent API key.
Docker: Have Docker and Docker Compose installed on your machine.
Run This Quckstart Example​
The example below is provided as part of the Tracetest GitHub repo. You can download and run the example by following these steps:
Clone the Tracetest project and go to the Artillery + Playwright Quickstart:
git clone https://github.com/kubeshop/tracetest
cd tracetest/examples/quick-start-artillery-playwright
Follow these instructions to run the included demo app and TypeScript example:
- Copy the
.env.template
file to.env
. - Fill out the TRACETEST_TOKEN and ENVIRONMENT_ID details by editing your
.env
file. - Run
docker compose run tracetest-run
. - Follow the links in the output to view the test results.
Follow along with the sections below for an in detail breakdown of what the example you just ran did and how it works.