UNPKG

k6-cucumber-steps

Version:

Cucumber step definitions for running k6 performance tests.

1 lines 4.71 kB
{"list":[{"title":"CustomWorld","link":"<a href=\"global.html#CustomWorld\">CustomWorld</a>"},{"title":"Given_I_set_k6_script_for_method_testing","link":"<a href=\"global.html#Given_I_set_k6_script_for_method_testing\">Given_I_set_k6_script_for_method_testing</a>","description":"<p>Initializes the k6 script configuration by setting the primary HTTP method for the load test.</p>\n<pre class=\"prettyprint source lang-gherkin\"><code>Given I set a k6 script for {word} testing\n</code></pre>"},{"title":"Given_I_set_k6_script_for_method_testing#config","link":"<a href=\"global.html#Given_I_set_k6_script_for_method_testing#config\">config</a>"},{"title":"K6Config","link":"<a href=\"global.html#K6Config\">K6Config</a>"},{"title":"Then_I_store_value_as_alias","link":"<a href=\"global.html#Then_I_store_value_as_alias\">Then_I_store_value_as_alias</a>","description":"<p>Stores a value from the last API response into the Cucumber World's aliases context.</p>\n<pre class=\"prettyprint source lang-gherkin\"><code>Then I store the value at &quot;data.token&quot; as alias &quot;authToken&quot;\n</code></pre>"},{"title":"When_I_login_via_POST_with_payload_from_file","link":"<a href=\"global.html#When_I_login_via_POST_with_payload_from_file\">When_I_login_via_POST_with_payload_from_file</a>","description":"<p>Logs in via a POST request to a specified endpoint using a JSON payload from a file.\nThe response data is stored for subsequent steps.</p>\n<pre class=\"prettyprint source lang-gherkin\"><code>When I login via POST to &quot;/auth/login&quot; with payload from &quot;admin_credentials.json&quot;\n</code></pre>"},{"title":"When_I_set_authentication_type","link":"<a href=\"global.html#When_I_set_authentication_type\">When_I_set_authentication_type</a>","description":"<p>Sets the authentication type for the k6 request, generating relevant headers.</p>\n<pre class=\"prettyprint source lang-gherkin\"><code>When I set the authentication type to &quot;BearerToken&quot;\n</code></pre>"},{"title":"When_I_set_endpoints_used","link":"<a href=\"global.html#When_I_set_endpoints_used\">When_I_set_endpoints_used</a>","description":"<p>Sets the list of endpoints to be used in the k6 script. These are typically used when\nthe k6 script iterates over multiple URLs.</p>\n<pre class=\"prettyprint source lang-gherkin\"><code>When I set the following endpoints used:\n/api/v1/users\n/api/v1/products\n/api/v1/orders\n</code></pre>"},{"title":"When_I_set_k6_script_configurations","link":"<a href=\"global.html#When_I_set_k6_script_configurations\">When_I_set_k6_script_configurations</a>","description":"<p>Configures the k6 script options (VUs, duration, stages, thresholds) from a data table.</p>\n<pre class=\"prettyprint source lang-gherkin\"><code>When I set to run the k6 script with the following configurations:\n| virtual_users | duration | stages | http_req_failed | http_req_duration | error_rate |\n| 10 | 30 | | p(99)&lt;0.01 | p(99)&lt;500 | rate&lt;0.01 |\n| | | [{&quot;duration&quot;:&quot;10s&quot;,&quot;target&quot;:10}] | p(90)&lt;0.01 | p(90)&lt;200 | rate&lt;0.001 |\n</code></pre>"},{"title":"When_I_set_method_body_for_endpoint","link":"<a href=\"global.html#When_I_set_method_body_for_endpoint\">When_I_set_method_body_for_endpoint</a>","description":"<p>Sets the request body for a specific HTTP method and endpoint.</p>\n<pre class=\"prettyprint source lang-gherkin\"><code>When I set the following POST body is used for &quot;/api/v1/create&quot;\n{ &quot;name&quot;: &quot;test&quot;, &quot;email&quot;: &quot;test@example.com&quot; }\n</code></pre>"},{"title":"When_I_set_request_headers","link":"<a href=\"global.html#When_I_set_request_headers\">When_I_set_request_headers</a>","description":"<p>Sets request headers for the k6 script. Headers are merged with any existing headers.</p>\n<pre class=\"prettyprint source lang-gherkin\"><code>When I set the request headers:\n| Header | Value |\n| Content-Type | application/json |\n| Authorization | Bearer &lt;my_token> |\n</code></pre>"},{"title":"When_I_use_JSON_payload_from_file_for_method_to_endpoint","link":"<a href=\"global.html#When_I_use_JSON_payload_from_file_for_method_to_endpoint\">When_I_use_JSON_payload_from_file_for_method_to_endpoint</a>","description":"<p>Loads a JSON payload from a file to be used as the request body for a specific\nmethod and endpoint in the k6 script.</p>\n<pre class=\"prettyprint source lang-gherkin\"><code>When I use JSON payload from &quot;user_create.json&quot; for POST to &quot;/api/v1/users&quot;\n</code></pre>"}]}