Announcing the Tracetest integration with k6: Deep Load Testing of your Cloud Native System
Tags: observability, testing, cloudnative, performance
Published: 2023-03-05 21:28:13


Today, we're happily announcing that [Tracetest](https://tracetest.io/) now works with [k6](https://k6.io/), a modern load-testing tool used by thousands of developers worldwide. The combination of k6 and Tracetest allows your load tests to check across your entire microservice, FaaS, or Kubernetes-based applications.

This checks that not only the top surface of the application returns the correct information and remains performant, but allows you to test and verify across the full distributed application, making sure none of the many services involve begin failing or taking too long under load.

![https://res.cloudinary.com/djwdcmwdz/image/upload/v1677495246/Blogposts/k6-tracetest-partnership/Screenshot_2023-02-27_at_11.52.24_niv29x.png](https://res.cloudinary.com/djwdcmwdz/image/upload/v1677495246/Blogposts/k6-tracetest-partnership/Screenshot_2023-02-27_at_11.52.24_niv29x.png)

## Load Testing Across a Distributed Application

Oscar, one of the developers of the [k6-tracetest extension](https://github.com/kubeshop/xk6-tracetest), shows why the combo is so potent:

[![](https://res.cloudinary.com/djwdcmwdz/image/upload/v1677495412/Blogposts/k6-tracetest-partnership/k6-Load_Testing_Across_a_Distributed_Application_pnbi12.png)](https://www.loom.com/embed/5c5e1261bb0b4fefa30081294378908c)

## What is k6?

[k6](https://github.com/grafana/k6) allows you to [build performant load tests](https://k6.io/docs/) that take a fraction of the resources legacy load-testing tools require. The tests are written in an easy-to-follow JavaScript form and can be extended with a number of extensions. The tests execute via a Go-JavaScript compiler so they take a minimal amount of resources when being executed, allowing the scaling of load tests with fewer resources.

## What is Tracetest?

Tracetest is an [open-source CNCF project](https://github.com/kubeshop/tracetest). It allows you to [quickly build integration and end-to-end tests](https://docs.tracetest.io/), supercharged by your existing distributed traces. The use of your existing distributed traces as part of the test enables assertions to be created across multiple microservices or parts of your distributed application.

Tracetest makes it possible to:

- Define tests and assertions against every single microservice that a request goes through.
- Work with your existing distributed tracing solution, allowing you to build tests based on your already instrumented system.
- Define multiple transaction triggers, such as a GET against an API endpoint, a gRPC request, etc.
- Return both the response data and a full trace.
- Define assertions against both the response and trace data, ensuring both your response and the underlying processes worked correctly, quickly, and without errors.
- Save tests.
- Run the tests manually or, via CI, build jobs with the Tracetest CLI.

## Tracetest Now Works with k6!

Tracetest now works with k6, allowing you to conduct load tests that verify your entire distributed application.

Most load-testing tools will trigger your application and apply tests against the response from the call. As you scale up the number of tests running concurrently, the system under test will be exercised. Assertions can be defined against any of the response data, whether it is the status codes, parts of the response body, or expected timing.

By including Tracetest in the k6 load test, you can test against both the response AND the information contained in the trace. This allows you to define powerful assertions against all the processes involved in servicing the call invoked by a load test. Some examples of checks it enables include:

- Checking the microservices on “the other side” of a message queue to verify it can handle the load. Typically when load-testing complex systems with message queues you cannot easily assert against the entire system, particularly when it has asynchronous calls.
- In one assertion, assert that all database queries across all microservices should return in less than 100ms, and verify this under load.
- Or that every gRPC process in the entire stack continues returning status codes of zero as the load increases.
- Showing you graphically, via the trace, where any detected failures occur across any of the runs.

The ability to observe and assert against the entire system under load, empowered by your current APM or observability platform, makes Tracetest and k6 a powerful combination.

## Try Tracetest with k6

Tracetest is [open-source](https://github.com/kubeshop/tracetest) and easy to install. First, install Tracetest CLI. Check out the [download page](https://tracetest.io/download) for more info. From here, follow the [official documentation](https://docs.tracetest.io/getting-started/installation) to install the Tracetest server.

Once the server is installed, open up Tracetest Web UI in the browser and define where Tracetest gets the traces from, whether Jaeger, Lightstep, Elastic, or any trace vendor. You can even send traces to Tracetest via the [OpenTelemetry collector](https://opentelemetry.io/docs/collector/). Check out the [Configuration Overview](https://docs.tracetest.io/configuration/overview) for help!

Once you have Tracetest working and can run trace-based tests against your distributed system, you will want to create a load test with k6. Use the [excellent k6 docs to get started](https://k6.io/docs/get-started/). You can then utilize the [k6-tracetest extension](https://github.com/kubeshop/xk6-tracetest) to run deep load tests. We have full documentation on how to use k6 and Tracetest together at [https://docs.tracetest.io/tools-and-integrations/k6](https://docs.tracetest.io/tools-and-integrations/k6).

The Tracetest team recently discussed the integration during the k6 Office Hours:

[![](https://res.cloudinary.com/djwdcmwdz/image/upload/v1677495485/Blogposts/k6-tracetest-partnership/try-tracetest-with-k6_ynbr93.png)](https://www.youtube.com/watch?v=Dog70D7aVyg)


## What's next?

This is the first version of the integration between k6 and Tracetest. Have any ideas for improving it? Interested in enabling trace-based testing for other load testing tools? Let us know by [creating an issue in Github](https://github.com/kubeshop/tracetest/issues/new/choose), or start a conversation with the team behind Tracetest in our [Discord community](https://discord.com/channels/884464549347074049/963470167327772703). You can also reach out to us to [schedule a call](http://calendly.com/ken-kubeshop/otel-user-interview-w-tracetest) to discuss your particular needs or get assistance.

Excited about the Tracetest project and trace-based testing? Give [Tracetest a star on GitHub](https://github.com/kubeshop/tracetest)!