CRUD Operations in K6 | Tech

Reading Time: 2 minutes

Hi Readers, In this blog, I am going to explore, HTTP methods in K6.

Basically, HTTP methods are also called HTTP verbs and CRUD operations because it is a set of requests which perform the desired actions like get, put, post, delete and so on.

CRUD stands for Create, Read, Update and Delete. These are four primitive database operations that map well to the HTTP verbs most frequently used in Rest Services.

HTTP request in K6-

In this, http module contains functionality like put() , get(), post(), delete(), head() etc.

GET() – GET is used to request data from a specified resource. Get requests to remain in the browser history.


  1. Install the K6 in your system-
  2. Install any IDE- Visual Studio-

Writing first Script in K6 with get method

Create one javascript file with.js- http_get.js and import the k6/HTTP into the js file- import http from k6/http.

Get http javascript

VUs(Virtual Users):-A number of users execute as many iterations as possible for a specified amount of time. 

Sleep:- Sleep doesn’t impact the test duration. It will impact how quickly the Virtual users can complete iterations.

Add Config.json-

http get javascript in k6

Run this file in the terminal- k6 run http_get.js(filename)

Run javascript file

POST() – POST is used to send data to a server to create a resource.

create one file with http_post.js

http post in k6

PUT() – PUT is used to send data to a server to create/update a resource.

create one file with http_put.js

Put method in k6

DELETE() – The DELETE method deletes the specified resource.

create one file with http_delete.js

Delete method in k6

I hope you enjoyed it and it helped you!! stay connected for more future blogs. 

Thank you!!


Written by 

Soniya is a QA consultant having experience of more than 3 years. She has experience with Performance testing, API testing and Automation testing(Selenium, Katalon, Cypress and k6). She is always eager to learn new and advanced concepts.