File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
modules/k6/src/test/java/org/testcontainers/k6 Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,23 @@ 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+ You can start a K6 container instance from any Java application by using:
15+
16+ <!-- codeinclude-->
17+ [ Setup the container] ( ../../modules/k6/src/test/java/org/testcontainers/k6/K6ContainerTests.java ) inside_block: standard_k6
18+ <!-- /codeinclude-->
19+
20+ The test above uses a simple k6 script, ` test.js ` , with command line options and an injected script variable.
21+
22+ Once the container is started, you can wait for the test results to be collected:
23+
24+ <!-- codeinclude-->
25+ [ Wait for test results] ( ../../modules/k6/src/test/java/org/testcontainers/k6/K6ContainerTests.java ) inside_block: wait
26+ <!-- /codeinclude-->
1527
1628Create a simple k6 test script to be executed as part of your tests:
1729
1830<!-- codeinclude-->
19- [ Setup the container] ( ../../modules/k6/src/test/java/org/testcontainers/k6/K6ContainerTests.java ) inside_block: standard_k6
2031[ Content of ` scripts/test.js ` ] ( ../../modules/k6/src/test/resources/scripts/test.js ) inside_block: access_script_vars
2132<!-- /codeinclude-->
2233
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ void k6StandardTest() throws Exception {
2323 ) {
2424 container .start ();
2525
26+ // wait {
2627 WaitingConsumer consumer = new WaitingConsumer ();
2728 container .followOutput (consumer );
2829
@@ -34,6 +35,7 @@ void k6StandardTest() throws Exception {
3435 3 ,
3536 TimeUnit .SECONDS
3637 );
38+ // }
3739
3840 assertThat (container .getLogs ()).contains ("k6 tests are cool!" );
3941 }
You can’t perform that action at this time.
0 commit comments