A modern load testing tool, using Go and JavaScript - https://k6.io
AGPL-3.0 License
Bot releases are visible (Hide)
Published by na-- almost 6 years ago
v0.23.0 is here! 🎉
Hopefully this is the last intermediary release before v1.0.0. It is a bit light on new features, but it includes a lot of bug fixes and minor improvements! Also, the latest
Docker tag will point to this release until we release the next stable one. Users wanting to use the bleeding edge k6 features can do that via the new master
docker tag, which is pushed by every CI build of the git master
branch.
Thanks to @sherrman, @ofauchon, @AndriiChuzhynov, @entone, @mariolopjr, and @tkbky for contributing to this release!
To see what's left for the v1.0.0 release, check out this milestone!
Also, have a look at our roadmap for what's up ahead, beyond the v1.0 release.
A new option has been added that disables the default behavior of resetting the cookie jar after each VU iteration. If it's enabled, saved cookies will be persisted across VU iterations. For the moment there's no CLI flag for this option, instead it can only be set via the noCookiesReset
key from the exported script options
or via the K6_NO_COOKIES_RESET
environment variable.
You can now specify what the type of an HTTP response's body should be with the new responseType
request option. The possible values for it are text
(the default), binary
and none
. The default text
response type is backward-compatible, it doesn't change the current k6 behavior of returning the body
attribute of the http/Response
object as a string. It's well suited for working with web pages, text-based APIs and similar HTTP responses, but it can be unsuitable when dealing with binary files.
That's mostly because JavaScript strings are encoded with UTF-16 and converting binary data to it will frequently mangle some of the data. The new binary
response type allows us to avoid that, it causes k6 to return the HTTP response's body
as a byte array. This allows us to deal with the binary data without mangling it:
import http from 'k6/http';
import { sha256 } from 'k6/crypto';
export default function () {
const expectedLogoHash = "fce7a09dde7c25b9822eca8438b7a5c397c2709e280e8e50f04d98bc8a66f4d9";
let resp = http.get("http://test.loadimpact.com/images/logo.png", { responseType: "binary" });
let logoHash = sha256(resp.body, "hex");
if (logoHash !== expectedLogoHash) {
throw new Error(`Expected logo hash to be ${expectedLogoHash} but it was ${logoHash}`);
}
http.post("https://httpbin.org/post", resp.body);
};
Saving HTTP response bodies is generally useful, especially when we need to use them (or parts of them) in subsequent requests. But in many cases it makes little to no sense to spend memory on saving the response body. For example, when requesting static website assets (JS, CSS, images etc.) or web pages without needed information, the actual file contents rarely matter when running load tests.
For cases like that, the value none
for the responseType
option allows k6 to discard incoming data on arrival, in order to save CPU cycles and prevent unnecessary copying of data. When enabled, the actual HTTP response body would be fully downloaded (so that the load test and all HTTP metrics for that request are still accurate), it just won't be saved in memory and passed on to the JavaScript runtime at all - the response.body
attribute would be null
:
import http from 'k6/http';
import { check } from "k6";
export default function () {
const url = "http://test.loadimpact.com";
let resp = http.get(url);
let cssFile = resp.html().find("link[rel='stylesheet']").attr("href");
check(http.get(`${url}/${cssFile}`, { responseType: "none" }), {
"body was empty": (res) => res.body === null,
"response code was 200": (res) => res.status == 200,
"timings are present": (res) => res.timings.duration > 0,
});
};
For convenience, there's also a new global config option that causes k6 to discard response bodies by default by switching the default responseType
value to none
. It can be enabled via the --discard-response-bodies
CLI flag, the K6_DISCARD_RESPONSE_BODIES
environment variable, or the discardResponseBodies
script option:
import http from 'k6/http';
export let options = {
discardResponseBodies: true,
};
export default function () {
let response = http.get("http://test.loadimpact.com", { responseType: "text" });
// ... do something with the response, but ignore the contents of static files:
http.batch([
"http://test.loadimpact.com/images/logo.png",
"http://test.loadimpact.com/style.css"
]);
};
Thanks to @sherrman for reporting the binary handling issues that prompted the addition of the responseType
option! And thanks to @ofauchon for implementing both of the discard response body options, of which the local per-request one was later transformed into the responseType=none
value!
Response.json()
method now supports selectorsThe selectors are implemented with the gjson library and allow optimized lookups and basic filtering of JSON elements in HTTP responses, which could be especially useful in combination with k6 checks:
import http from "k6/http";
import { check } from "k6";
export default function () {
let resp = http.get("https://api.spacexdata.com/v2/launches/");
let currentYear = (new Date()).getFullYear();
check(resp, {
"falcon heavy": (r) => r.json("#[flight_number==55].rocket.second_stage.payloads.0.payload_id") === "Tesla Roadster",
"no failure this year": (r) => r.json("#[launch_success==false]#.launch_year").every((y) => y < currentYear),
"success ratio": (r) => r.json("#[launch_success==true]#").length > 10 * r.json("#[launch_success==false]#").length,
});
}
Thanks to @AndriiChuzhynov for implementing this! (#766)
A new option that disables the end-of-test summary has been added. That summary is often superfluous when k6 tests are run in a distributed execution mode, or when the generated metrics are piped to an external output like InfluxDB or Load Impact Insights. The option can be enabled with the --no-summary
CLI flag or the K6_NO_SUMMARY
environment variable. When both it and the and the --no-thresholds
option are enabled, k6 won't store any generated metrics in-memory, making the test execution a bit more efficient.
You can now specify the minimum amount of time a single iteration should take via the new minIterationDuration
option. It's also configurable via the --min-iteration-duration
CLI flag and K6_MIN_ITERATION_DURATION
environment variable. This setting only applies for full iterations, so any interrupted iterations due to ramping down of VUs from a stage or at the end of the tests can still be shorter.
batch
and batchPerHost
options. They determine the maximum number of parallel requests (in total and per-host respectively) an http.batch()
call will make per VU. The previous value for batch
was 10 and for batchPerHost
it was 0 (unlimited). We now also use their values to determine the maximum number of open idle connections in a VU. (#685)master
branch will now tag the resulting docker image as master
as well. The latest
docker tag will point to the latest stable official release, so it will be equivalent to v0.23.0
until we release the next k6 version. (#846)k6 login influxdb
command failed to write the supplied options to the config file. (#734)k6 login influxdb
and k6 login cloud
. (#734)k6 login
subcommands. (#734)http.batch()
calls could panic because of a data race when the batchPerHost
global option was used. (#770)options
or environment variables couldn't be disabled via the CLI flags. (#786)undefined
(when there is no setup()
function or when it doesn't return anything) and null
(when setup()
explicitly returns null
) values for the setup data
that's passed to the default function and teardown()
. (#799)pages
array. (#806)http.Response
weren't properly encoded when they were returned from the setup()
function. (#804)k6 cloud
. Most notably this includes K6_CLOUD_PROJECT_ID. (#829)group()
is called without a callback function. (#841)._!?/&#()<>%-
. They also need to be between 1 and 128 characters. Previously practically anything was a valid metric name. (#810)Published by na-- about 6 years ago
A minor release that adds some UX improvements and fixes some of the issues in the v0.22.0 release.
options
, environment variables and command-line flags) are now exported back into the options
script variable and can be accessed from the script. Thanks to @mohanprasaths for working on this! (#681 and #713)--no-color
flag caused k6 to print output intended for sdtout
to stderr
instead. (#712)--logformat
option. (#712)Published by robingustafsson over 6 years ago
v0.22.0 is here! 🎉
We're making an intermediary release before v1.0.0, as we wanted to get some changes out quicker. Thanks to @mohanprasaths for contributing to this release!
To see what's left for the v1.0.0 release, check out this milestone!
Also, have a look at our roadmap for what's up ahead, beyond the v1.0 release.
import {randomSeed} from "k6";
randomSeed(123456789);
let rnd = Math.random();
console.log(rnd)
--no-vu-connection-reuse
lets users close HTTP keep-alive
connections between iterations of a VU. (#676)--min-sleep
and --max-sleep
HAR coverter CLI flags. (#694)--options
flag. (#694)Previously we only had Homebrew releases for Mac and simple archives with plain binary releases for all other platforms. From now on, we'll also automatically build installation packages for Windows and rpm or deb based Linux distributions and upload them to bintray on every new release: https://bintray.com/loadimpact
For Debian-based Linux distributions, you have to do something like this to install k6:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61
echo "deb https://dl.bintray.com/loadimpact/deb stable main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install k6
And for rpm-based ones like Fedora and CentOS:
wget https://bintray.com/loadimpact/rpm/rpm -O bintray-loadimpact-rpm.repo
sudo mv bintray-loadimpact-rpm.repo /etc/yum.repos.d/
sudo yum install k6
For Windows you can download and install the latest .msi
package or, if you use the chocolatey package manager, follow these instructions to set up the k6 repository.
k6 login cloud --reset
(#672)Previously most metrics were emitted only when a script iteration ended. With these changes, metrics would be continuously pushed in real-time, even in the middle of a script iteration. This should slightly decrease memory usage and help a lot with the aggregation efficiency of the cloud collector.
Before this, k6 builds that were done with just the standard Go language tools (i.e. go get
, go build
, etc.) were not portable because static resources like JS libraries had to be embedded in the binary after the build. Building fully portable binaries was done with the build-release.sh
script (which used go.rice to bundle the static resources in the binary), but now that embedding is done beforehand and is commited in the git repo, so commands like go get/build/install
produce fully-portable binary files without extra steps.
setup()
and teardown()
are not discarded anymore. They are emitted and have the implicit root group
tag values of setup
and teardown
respectively (#678)nil
pointer error when the k6 cloud
command is interrupted. (#682)--no-connection-reuse
option has been re-purposed and now disables keep-alive connections globally. The newly added --no-vu-connection-reuse
option does what was previously done by --no-connection-reuse
- it closes any open connections between iterations of a VU, but allows for reusing them inside of a single iteration. (#676)Published by robingustafsson over 6 years ago
A bug fix release to fix some issues in the v0.21.0 release.
http_req_sending
values in the summary (#651)setup()
and teardown()
timeouts even when triggered by the API (#661)Published by robingustafsson over 6 years ago
v0.21.0 is here! 🎉
We're happy to see continued contributions from members of the community in this release, from 4 people outside of Load Impact this time around. A big thanks to the following people for contributing to this release: @antekresic, @cyberw, @danron and @jmccann. Also, thanks to everyone that contributed in other ways on Github, in Slack and for spreading the word about k6!
To see the current plan for the next release, check out this milestone, which we aim to make the v1.0 release!
Have a look at our roadmap for what's up ahead, beyond the v1.0 release.
--tag
flag and tags
option to set test-wide tags (#553)You can now specify any number of tags on the command line using the --tag NAME=VALUE
flag. You can also use the tags
option to the set tags in the code.
The specified tags will be applied across all metrics. However if you have set a tag with the same name on a request, check or custom metric in the code that tag value will have precedence.
Thanks to @antekresic for their work on this!
Docs: Test wide tags and Options
--summary-time-unit
flag (#638)You can now specify the time unit used to show the summary trend stats. It can be: 's' for seconds, 'ms' for milliseconds or 'us' microseconds.
$ k6 run --summary-time-unit ms ~/script.js
Docs: Options
import http from "k6/http";
import { check } from "k6";
export default function() {
// Passing username and password as part of URL plus the auth option will authenticate using HTTP Digest authentication
let res = http.get("http://user:[email protected]/path", {auth: "ntlm"});
// Verify response
check(res, {
"status is 200": (r) => r.status === 200
});
}
Docs: HTTP Params
There is now support for correlating JSON values in recordings, replacing recorded request values with references to the previous response.
Thanks to @cyberw for their work on this!
Since InfluxDB indexes tags, highly variable information like vu
, iter
or even url
may lead to high memory usage. The InfluxDB documentation recommends to use fields in that case, which is what k6 does now. There is a new INFLUXDB_TAGS_AS_FIELDS
option (collectors.influxdb.tagsAsFields
in the global k6 JSON config) that specifies which of the tags k6 emits will be sent as fields to InfluxDB. By default that's only url
(but not name
), vu
and iter
(if enabled).
Thanks to @danron for their work on this!
Previously the setup()
and teardown()
functions timed out after 10 seconds. Now that period is configurable via the setupTimeout
and teardownTimeout
script options or the K6_SETUP_TIMEOUT
and K6_TEARDOWN_TIMEOUT
environment variables. The default timeouts are still 10 seconds and at this time there are no CLI options for changing them to avoid clutter.
Metrics streamed to the Load Impact cloud can be partially aggregated to reduce bandwidth usage and processing times. Outlier metrics are automatically detected and excluded from that aggregation.
Docs: Load Impact Insights Aggregation
The default sleep time added at the end of the generated test has been changed from 2-4s to 20-40s to be more realistic (although still probably on the low end for some types of sites [1][2]).
[1] - https://moz.com/blog/ecommerce-benchmark-kpi-study-2017
[2] - https://www.brafton.com/blog/strategy/brafton-2017-content-marketing-benchmark-report/
It's now possible to add the remote server's IP address to the tags for HTTP and WebSocket metrics. The ip
system tag is not included by default, but it could easily be enabled by modifying the systemTags
option.
There is a new log format called raw
. When used, it will print only the log message without adding any debug information like, date or the log level. It should be useful for debuging scripts when printing a HTML response for example.
$ k6 run --log-format raw ~/script.js
There is now support for outputing metrics to Apache Kafka! You can configure a Kafka broker (or multiple ones), topic and message format directly from the command line like this:
k6 --out kafka=brokers={broker1,broker2},topic=k6,format=json
The default format
is json
, but you can also use the InfluxDB line protocol for direct ingestion by InfluxDB:
k6 --out kafka=brokers=my_broker_host,topic=k6metrics,format=influxdb
You can even specify format options such as the tagsAsFields
option for InfluxDB:
k6 --out kafka=brokers=someBroker,topic=someTopic,format=influxdb,influxdb.tagsAsFields={url,name,myCustomTag}
Docs: Apache Kafka output
Thanks to @jmccann for their work on this!
It's now possible to simultaneously send the emitted metrics to several outputs by using the CLI --out
flag multiple times, for example:
k6 run --out json=test.json --out influxdb=http://localhost:8086/k6
Thanks to @jmccann for their work on this!
There's now a new CLI flag --exit-on-running
when running cloud tests (k6 cloud ...
) to have k6 exit when the test reaches the running state.
open
function outside init context (#563)-race
(#564)Selection.each(fn)
function, which was returning only the first element. (#610)--no-color
option is now being repected for the logs. (#634)no_compress
and project_id
and the payload_size
InfluxDB option have been renamed to noCompress
, projectID
and payloadSize
respectively, to match the other JS option names.Published by robingustafsson over 6 years ago
Lots of goodies in this release! 🎉
We are working towards a 1.0 release of k6, and as part of this release we've also published our roadmap for 2018 in the Github wiki, here it is. We welcome comments and discussion relating to the roadmap, both in the corresponding issues as well as in Slack.
Once again we saw contributions from several members of the community in this release, from 9 people outside of Load Impact, woop woop! A big thanks to the following people for contributing to this release: @antekresic, @cstyan, @cyberw, @danron, @dstpierre, @luizbafilho, @marklagendijk, @na-- and @pkruhlei.
Two of the above contributors have also become full time employees of Load Impact since the last release, to accelerate the development of k6. We welcome @luizbafilho and @na-- to the distributed k6 core team!
To see the current plan for the next release, check out this milestone.
The init context open()
function now supports binary files:
import http from "k6/http";
import {md5} from "k6/crypto";
let binFile = open("./image.png", "b");
export default function() {
console.log(md5(binFile, "hex"));
}
and the HTTP module has handily gained support for multipart requests:
import http from "k6/http";
let binFile = open("./image.png", "b");
export default function() {
var data = {
field: "this is a standard form field",
file: http.file(binFile, "my image file.png")
};
var res = http.post("https://example.com/upload", data);
}
Thanks @dstpierre for their work on this!
Docs: Multipart requests
Request information is now exposed through the Response object:
import http from "k6/http";
export default function() {
let res = http.get("https://example.com/")
console.log(`Method: ${res.request.method}`);
new Map(Object.entries(res.request.headers)).forEach((v, k) => console.log(`Header: ${k}=${v}`));
console.log(`Body: ${res.request.method}`);
}
Thanks to @cstyan for their work on this!
Docs: Request information
Finally k6 has the same basic test lifecycle hooks as many "normal" testing tools, setup and teardown, and you have the full JS API of k6 available within these functions which means you can make HTTP calls etc. that you can’t do in the global/init scope.
To use the lifecycle hooks you simply define an exported setup() and/or teardown() function in your script:
export function setup() {
return { “data”: “passed to main and teardown function” };
}
export function teardown(data) {
console.log(JSON.stringify(data));
}
export default function(data) {
if (data.v != 1) {
throw new Error("incorrect data: " + JSON.stringify(data));
}
}
Docs: Test life cycle
If you specify --http-debug
when running a test k6 will now continuously print request and response information.
Thanks to @marklagendijk for their work on this!
Docs: HTTP debugging
Overriding DNS resolution of hostnames can come in handy when testing a system that is run in multiple environments (dev, staging, prod etc.) with different IP addresses but responds to the same Host
header.
import http from "k6/http";
export let options = {
hosts: {
"loadimpact.com": "1.2.3.4",
"test.loadimpact.com": "5.6.7.8"
}
};
export default function() {
http.get("http://loadimpact.com/");
http.get("http://test.loadimpact.com/");
}
Tip: you can use environment variables to switch the IP based on environment.
Thanks @luizbafilho for their work on this!
Docs: DNS Override option
-e
flag environment variable flag (#495)You can now specify any number of environment variables on the command line using the -e NAME=VALUE
flag.
As a matter of security, when running k6 cloud ...
or k6 archive ...
the system's environment variables will not be included in the resulting archive, you'll now have to use the new --include-system-env-vars
flag to get that behavior. When executing k6 run ...
the system's environment will continue to be exposed to your script.
We encourage the use of -e NAME=VALUE
to make environment variable use explicit and compatible across local and cloud execution.
Thanks @na-- for their work on this!
Docs: Environment variables
--no-batch
flag (#497)A --no-batch
CLI flag has been added to k6 convert
command to disable the creation of batch request statements in favor of individual http.get/del/options/patch/post/put
statements.
Thanks @danron and @cyberw for their work on this!
--return-on-failed-check
flag (#499)A --return-on-failed-check
CLI flag has been added to k6 convert
command to optionally return/exit the current VU iteration if a response status code check fails (requires the existing --enable-status-code-checks
to be specified as well).
Thanks @cyberw for their work on this!
--correlate
flag (#500)A first step towards doing correlations when converting HAR to JS has implemented. In this first iteration, if --correlate
is specified the converter will try to detect issues with redirects.
Thanks @cyberw for their work on this!
The percentile calculation has been changed to use linear interpolation of two bounding values if percentile doesn't precisely fall on a value/sample index.
Up until now thresholds were evaluated continuously throughout the test but could never abort a running test.
This PR adds functionality to specify that a test run should abort the test as soon as a threshold evaluates to false, optionally with a delay in threshold evaluation to avoid aborting to early when the number of samples collected is low.
export let options = {
thresholds: {
"http_req_duration": ["avg<100", { threshold: "p(95)<200", abortOnFail: true, delayAbortEval: "30s" }]
}
};
Thanks @antekresic for their work on this!
Docs: Thresholds with abort
Thanks @pkruhlei for their contribution!
Adds a CLI option --system-tags "url,method,status"
to specify a whitelist of system tags that will be included in the metrics output.
The following tags can be specified:
url
(http, websocket)method
(http)status
(http, websocket)proto
(http)subproto
(websocket)error
(http)name
(http)group
(http)check
(http)tls_version
(http)ocsp_status
(http)iter
(vu)vu
(vu)All but the last 3 (ocsp_status
, iter
, vu
) are included by default. Some collectors (e.g. cloud
) could require that certain tags are included.
Docs: System tags
import http from "k6/http";
import { check } from "k6";
export default function() {
// Passing username and password as part of URL plus the auth option will authenticate using HTTP Digest authentication
let res = http.get("http://user:[email protected]/digest-auth/auth/user/passwd", {auth: "digest"});
// Verify response
check(res, {
"status is 200": (r) => r.status === 200,
"is authenticated": (r) => r.json().authenticated === true,
"is correct user": (r) => r.json().user === "user"
});
}
Docs: HTTP Params
HAR converter: Fixed issue with construction of body
parameter when PostData.Params
values are present. (#489)
Stats: Fixed output of rate metrics to truncate rather than round when converting to string representation from float for summary output.
Stats: Fixes issue where calls to TrendSink.P()
and TrendSink.Format()
could return wrong results if TrendSink.Calc()
hadn't been previously called. (#498)
Cloud/Insights: Fixed issue causing default test name to be empty when parsing script from STDIN (#510)
Cloud/Insights: Fixed handling of unexpected responses from server. (#522)
Stats: Fixed issue with calculation of data_received
and data_sent
metrics. (#523)
WebSockets: Fixed issue that different TLS settings like InsecureSkipTLSVerify
were ignored for websockets (#531)
SummaryTrendStats
configuration option has been renamed to summaryTrendStats
, to match all of the other JS option names.Published by robingustafsson over 6 years ago
The first release of 2018! 🎉
We have contributions from 10 people outside of Load Impact in this release, yay! To celebrate that and make onboarding of new users and contributors easier we’ve improved the README to give a better overview of the project and the Contributing guide with better instructions how to get a k6 dev environment set up.
A big thanks to the following people for contributing to this release: @antekresic, @borjacampina, @cstyan, @dstpierre, @ivoreis, @jonathon-l, @marklagendijk, @Ripolin, @tbroadley, and @tmcgannon
k6 now has a builtin command k6 convert recording.har > recording.js
to convert HAR files to JS. This is great for being able to quickly go from a browser/proxy recording to a k6 script, a common flow for getting started with a new test case.
Thanks to @borjacampina for their work on this!
Docs: HAR converter
A global request per second limiter has been added to k6. It will trigger if the RPS level goes above the set value, blocking further requests for a short period to maintain the desired level.
export let options = {
rps: 100
};
Or --rps
on the CLI.
You can now output logs in JSON format! It looks something like this:
{"level":"debug","msg":"Engine terminated cleanly","time":"2017-12-20T12:30:35Z"}
Thanks to @ivoreis for this PR!
Adds handling of deflate (as specified in RFC 1950) encoded response bodies by automatically decompressing them.
Same as the one above but for gzip. k6 previously automatically handled gzip compressed bodies as long as no Accept-Encoding
header was explicitly specified when making a request, but this adds transparent decompression as long as the Content-Encoding
header in a response is set to gzip.
Thanks to @Ripolin for discovering the discrepancy in the handling of gzipped responses and for fixing it!
k6 will now measure TLS handshaking time. The metric is called http_req_tls_handshaking
and is accessible in scripts as res.timings.tls_handshaking
.
Thanks to @antekresic for this PR!
This feature adds some missing jQuery APIs for serializing form elements to a URL-encoded string, array or object.
import http from "k6/http";
export default function() {
let res = http.get(“https://example.com/form”);
let form = res.html().find('form');
const serialized = form.serializeObject();
}
Thanks to @marklagendijk for their work on this!
Docs: serialize(), serializeArray() and serializeObject()
A sister feature to the one above, adding a submitForm(...)
method to the response object for making it easier to work with HTML form submissions.
import http from "k6/http";
export default function() {
let res = http.get(“https://example.com/form”);
res = res.submitForm({ fields: { message: "hello world" });
}
Again, thanks to @marklagendijk for their work on this!
Docs: Response.submitForm() and Working with HTML forms
Up until v0.13.0 k6 supported CONNECT
, OPTIONS
and TRACE
methods, besides the more common HTTP methods. In v0.13.0 these methods were then lost in a big refactor where we switched JS engine from Otto to goja.
Thanks to @cstyan for this PR!
A wrapper around the Selection API to locate an link/anchor tag in the response HTML and generate a click request. It adds a clickLink(...)
method to the response object.
import http from "k6/http";
export default function() {
let res = http.get("https://httpbin.org/links/10/0");
res = res.clickLink({ selector: 'a:nth-child(4)' })
}
Yet again, thanks to @marklagendijk for their work on this!
Docs: Response.clickLink()
iteration_duration
metric, vu
and iter
tags (#460)A new metric, iteration_duration
, has been added to k6. It measures the time it takes to run one full iteration of the default/main function. Most builtin metrics (http, group, checks etc.) are now also automatically tagged with vu
and iter
tags, representing the VU and iteration number where the metric data point was collected.
A new CLI option --summary-trend-stats avg,med,max,p(95),p(99),p(99.9)
for specifying what stats to show for trend metrics (response times) in the summary output after a test run has finished.
Thanks @antekresic for this contribution!
By default k6 will now send a user-agent string in the following format: k6/0.19.0 (https://k6.io/);
.
k6/http: The val() Selection method now properly returns an empty string for input fields when the value attribute is missing. (#435, thanks @marklagendijk)
k6/http: Fixed three bugs related to cookie handling when doing redirects. (#479, thanks @marklagendijk)
Archive: Fixed JSON encoding of <, > and & characters. (#421, thanks @dstpierre)
Engine: Improved stability of some tests to decrease flakiness of CI builds.
Stats: Fixed median calculation when sample count is even (#432, thanks @tmcgannon)
Docs: Fixed typo in README (#433, thanks @tbroadley)
Docs: Fixed broken link in README (#482, thanks @jonathon-l)
Published by liclac almost 7 years ago
Features:
k6/http: Limit concurrent requests in http.batch() calls. (#296)
export let options = {
batch: 20, // Default: 10
}
Flag to blacklist certain IP ranges from being called from scripts. (#389)
Flag to disable running of thresholds. (#42)
Archives now contain original sources, not transpiled gibberish. (#387)
k6/http: Enabled TLS Renegotiation
Fixed:
-o cloud
-o cloud
failing when sources were read from stdin (#375)Published by liclac almost 7 years ago
This release was quite some time in the making, and for good reason - we changed a ton of stuff under the hood, merged a bunch of big features, and we had to make sure it was all stable before releasing it out into the wild.
Note! This version removes the web UI, which has been unmaintained and deprecated for several releases. If you're interested in maintaining a web UI, please contact us and we can work something out. (#300)
Note! Due to some significant changes in how we store disk configuration, if you previously used k6 login
to store credentials for influxdb, you will need to do so again after updating to v0.18.0.
This is a huge feature and incredibly exciting to us - res.html()
now returns an object that supports the full jQuery API!
check(http.get("http://example.com/"), {
"status is 200": (r) => r.status === 200,
"caption is correct": (r) => r.html("h1").text() == "Example Domain",
})
Well, we say the full, but there are actually two exceptions: stuff like height()
and width()
that only makes sense if you're actually rendering the page in a browser, and anything that modifies the document (data("key", "value")
), which doesn't make any sense in the context of a load testing tool.
If you'd like to see these two added, show us a use case and we'll see what we can do!
It's worth noting that this isn't just a huge feature, it's the single biggest pull request I have ever seen, adding over 5000 lines of code (many of which are code generated!). For scale, the entire k6 codebase (before this PR) was around 20,000 lines.
Huge thanks to @mitnuh for their tireless work on this!
This is a huge change and the biggest culprit for this delay - because the CLI is so important, and because of the sheer size of this change, we couldn't just ship it off until we were absolutely sure it worked.
Not only is the new CLI code substantially easier to work with for us - we don't have to get all antsy about adding any CLI-facing features out of fear we may break something:
k6 --help
) are now more helpful, complete with usage examples.k6 run -v
now works, not just k6 -v run
).Yup. Instead of -u 100
/--vus 100
, or specifying the vus: 100
option, you can now set K6_VUS
in the environment instead.
The order of predecence for this is: defaults > disk config > script options > environment variables > commandline flags.
http.batch()
(#295)http.batch([
{ "method": "GET", "url": "http://example.com/" },
])
Thanks to @borjacampina for this contribution!
HTTP responses now have several new fields, all of which are also exported as tags, and a couple of new constants for their values:
tls_version
(eg. http.TLS_1_2
)tls_cipher_suite
(eg. "TLS_RSA_WITH_RC4_128_SHA"
)ocsp
produced_at
(timestamp, ms)this_update
(timestamp, ms)next_update
(timestamp, ms)revoked_at
(timestamp, ms)revocation_reason
(eg. http.OCSP_REASON_KEY_COMPROMISE
)status
(eg. http.OCSP_STATUS_GOOD
)This is a pretty big feature youthat has been asked about for a long time - we now have a comprehensive API for anything you could possibly want to do regarding cookies.
There's much more, but the biggest thing that's been asked for is how to manually set a cookie for a request, and read it back out - without messing about with manually constructing HTTP headers:
check(http.get("http://example.com/", { cookies: { name: "value" } }), {
"status is 200": (r) => r.status === 200,
"some cookie is set": (r) => r.cookies.my_cookie === "hi",
});
With the web UI gone, we could drop our Node dependency, and we're also now using Alpine Linux base images.
Thanks to @StephenRadachy for this contribution!
The code responsible for loading JS files now skips invoking Babel for files that are already valid ES5. Yes, it was actually that simple, and it cuts minutes(!) off loading big, already minimised libraries like Faker.js.
What it says on the tin. Supports normal or URL-safe encodings.
import enc from "k6/encoding";
export default function() {
console.log(enc.b64encode("hello!!")); // aGVsbG8hIQ==
console.log(enc.b64encode("hello!!", "rawurl")); // aGVsbG8hIQ
}
The iterations
metric wasn't exported properly. (#313)
Sporadic errors at the end of tests. (#358)
Incorrect scaling/failed requests at the start of a test when using stages. (#326)
k6/ws: The close
event sometimes wouldn't be emitted. (#329)
k6/ws: Respond to pings with pongs as decreed by the ws spec. (#330)
k6/ws: Missing metrics at the end of a test. (#333)
cloud: Anonymous tests with -o cloud
now show correct URLs. (#348)
cloud: More useful error messages from tests with -o cloud
.
Published by ragnarlonn about 7 years ago
TLS client certificates:

export let options = {

tlsAuth: [
{ domains: ["example.com"], cert: open("mycert.pem"), key: open("mycert-key.pem") }

]

};
Reduced memory usage: Using buffer pools for HTTP responses
Published by liclac about 7 years ago
New Features:
Fixed:
__VU
now works again; was broken in v0.17.0 (#280)Published by liclac over 7 years ago
TLS configuration options (thanks @gbts!) #235
export let options = {
tlsCipherSuites: [
"TLS_RSA_WITH_RC4_128_SHA",
"TLS_RSA_WITH_AES_128_GCM_SHA256",
],
tlsVersion: {
min: "ssl3.0",
max: "tls1.2"
},
};
HMAC support added to the k6/crypto
module (thanks @edgardoalz!) #256
A new, more intuitive way to display checks (thanks @ppcano!) #253
Percentiles in metrics now displayed as p(95)
rather than p95
, for consistency with the threshold syntax (@ppcano again!) #255
New proto
tag on http_*
metrics for telling whether HTTP/1.1 or HTTP/2.0 is used. f4b4456da2fb859f7c8bfb64bb58ccaa34bc431e
data_sent
and data_received
values (thanks @jkpl!) #272console.log()
calls made past the end of the test are now ignored. 77c90b8d8da0702f001f329dd50b5b19411d646fdocker-compose
now allows anonymous access. #260…along with some major changes under the hood: the groundwork for cloud- and clustered execution, simpler and more resilient VU orchestration algorithms, and more.
Also: we now have a beautiful Grafana dashboard for k6 and InfluxDB, contributed by @geekdave! Check it out: https://grafana.com/dashboards/2587
Published by liclac over 7 years ago
New Features:
k6 login influxdb
; no more need to pass in URLs. (#179)http.url
"tag" for interpolating templated URLs. (#148)Fixed:
http.batch()
that could lose samples. (b2e140c557449739201fbd0b6be7a3642cf8d0cc)Published by liclac over 7 years ago
New Features:
timeout
option for HTTP requests.userAgent
option for HTTP requests.Fixed:
__ENV
was broken in v0.13.0.insecureSkipTLSVerify
was broken in v0.13.0.HTTP_PROXY
/HTTPS_PROXY
/NO_PROXY
in the environment weren't respected properly.Published by liclac over 7 years ago
New Features:
k6/crypto
module (thanks @gbts!)Fixed:
Published by liclac over 7 years ago
After a long time in the making, our new and improved JS runner is here! Everything (especially startup) should now be significantly faster, but there may still be some rough edges here and there.
Published by ragnarlonn over 7 years ago