Load Impact’s Insights allows you to stream the results of your local k6 test run to Load Impact’s cloud services. You can then view and analyze the result in the web browser. To do this you need a k6 cloud token (you can generate one from your Load Impact account when you join the insider program). You then run k6 locally with the -o cloud flag:
$ K6CLOUD_TOKEN=<your_token> k6 -o cloud script.js
When you run a local load test with k6 you have the option to output the result to Load Impact’s Insights. This post briefly sums up the various run states the test will go through, and how we indicate that in the web interface. You can see the states directly in the browser window.
As your test runs, the test's run state will be marked as Running (a purple bar in the overview). A test run that ran its course will be marked Finished (green). It’s important to remember that the run state has nothing to do with the test actually passing any of the checks you defined for it. It only tells you that the test itself is operating correctly.
If you deliberately abort your local k6 test run (e.g. by pressing Ctrl-C), it will still be considered Finished by our online service. You can still look and analyze the test data you streamed so far. The test will just have run shorter than originally planned.Another possibility would be if you lose network connection while your test is running. In this case you will see connection errors stacking up in the k6 output. Load Impact’s service will however patiently wait for you to reconnect. Meanwhile your test's run state will continue to appear as Running in the overview. If no data is forthcoming, we will eventually time out after about two minutes. Your run state will then become Timed out and be marked red in the overview. You can still analyze a timed-out test. Just keep in mind it didn’t run its course and you’ll only have access to as much data as was streamed before the network issue.