In this brief post, we will cover how to add individual requests to groups using the tags feature of k6. This feature can be used to label thresholds for reporting on grouped requests. By separating result metrics generated by your k6 test, it can become possible to isolate the performance of individual or related requests.
Suppose for a given test we have identified a performance issue; however the test is made up of several different requests. These separate requests each call essential endpoints for the process tested, and therefore would not be feasible to test them individually out of context. Nonetheless, we suspect that one of these requests is degrading the performance of the overall test.
Using the http_req_duration threshold
, the example below illustrates how we can create two groups named “Product_Listing
” and “Product_Details
”. These groups are referenced in the requests that follow using tags:
When we run our script, the test summary will now reflect separate metrics for http_req_duration
for each of our defined tag groups:
If you are running your test on RedLine13, you can download the test summary at the conclusion of the test as long as you have output files enabled. Analyzing this file, it is now possible to pinpoint performance discrepancies at the request level. In our hypothetical example, the “Product_Listing
” endpoints are taking 5-10 times longer to complete than the “Product_Details
” endpoints.
Did you know that RedLine13 offers a full-featured, time-limited free trial? Sign up now, and start testing today!