Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.65 KB

File metadata and controls

44 lines (32 loc) · 1.65 KB

k6 Module

!!! note This module is INCUBATING. While it is ready for use and operational in the current version of Testcontainers, it is possible that it may receive breaking changes in the future. See our contributing guidelines for more information on our incubating modules policy.

Testcontainers module for k6.

k6 is an extensible reliability testing tool built for developer happiness.

Basic script execution

The following example shows a typical JUnit 5 test that runs a k6 script inside a container, waits for the run to finish, and asserts on the output.

Running a k6 script in a JUnit test inside_block:standard_k6_test

The test above uses a simple k6 script, test.js, with command line options and an injected script variable.

Create a simple k6 test script to be executed as part of your tests:

Content of scripts/test.js inside_block:access_script_vars

Adding this module to your project dependencies

Add the following dependency to your pom.xml/build.gradle file:

=== "Gradle" groovy testImplementation "org.testcontainers:testcontainers-k6:{{latest_version}}" === "Maven" xml <dependency> <groupId>org.testcontainers</groupId> <artifactId>testcontainers-k6</artifactId> <version>{{latest_version}}</version> <scope>test</scope> </dependency>