File tree Expand file tree Collapse file tree
modules/k6/src/test/java/org/testcontainers/k6 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,12 +11,17 @@ Testcontainers module for [k6](https://registry.hub.docker.com/r/grafana/k6).
1111
1212## Basic script execution
1313
14- Execute a simple k6 test script, ` test.js ` , with commandline options and injected script variable.
14+ 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.
15+
16+ <!-- codeinclude-->
17+ [ Running a k6 script in a JUnit test] ( ../../modules/k6/src/test/java/org/testcontainers/k6/K6ContainerTests.java ) inside_block: standard_k6_test
18+ <!-- /codeinclude-->
19+
20+ The test above uses a simple k6 script, ` test.js ` , with command line options and an injected script variable.
1521
1622Create a simple k6 test script to be executed as part of your tests:
1723
1824<!-- codeinclude-->
19- [ Setup the container] ( ../../modules/k6/src/test/java/org/testcontainers/k6/K6ContainerTests.java ) inside_block: standard_k6
2025[ Content of ` scripts/test.js ` ] ( ../../modules/k6/src/test/resources/scripts/test.js ) inside_block: access_script_vars
2126<!-- /codeinclude-->
2227
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ class K6ContainerTests {
1212
1313 @ Test
1414 void k6StandardTest () throws Exception {
15+ // standard_k6_test {
1516 try (
1617 // standard_k6 {
1718 K6Container container = new K6Container ("grafana/k6:0.49.0" )
@@ -37,5 +38,6 @@ void k6StandardTest() throws Exception {
3738
3839 assertThat (container .getLogs ()).contains ("k6 tests are cool!" );
3940 }
41+ // }
4042 }
4143}
You can’t perform that action at this time.
0 commit comments