1/23/2024 0 Comments Postman load test rest api![]() ![]() In the k6 result, you will see the output display the Load Impact URL. Select API Keys from the side navigation, then generate an API key and copy the value. Navigate to your Postman workspace at the top menu bar, click on your profile and select Settings. Run similar command as before but with additional parameter –o cloud K6 run –o cloud –vus 10 –duration 30s your-k6-script.js To resolve this, we need to generate an API key on Postman and also fetch the collection UID. Copy it and create Environment Variable in our machine named K6CLOUD_TOKEN and set the value to be the token that you just copied. We need to sign up and join, after that, click “Manage API Token” and try to generate the token. Once we login to the dashboard, click the profile and choose Insider Program. The cool thing is, we can achieve it by using cloud service () to manage the test result, store, and do some more analysis on the performance graph.įirst we need to create free account in (it has limitation up to 5 test cases). Next, open the current directory where you have that k6 script, run this in the command line K6 run –vus 10 –duration 30s your-k6-script.jsĪbove is the sample of the load testing result, as we can see, there are plenty information in numbers that can describe how the REST API handle the request/response with 10 users in 30 seconds.īut number sometimes is not intuitive and picture tells a thousand words. Since the script just contain simply HTTP/HTTPS request, you may need to add some checks in k6 script to verify certain things like the http status code or the transaction time. Now that you have the k6 script, you can start the load testing. Usage Postman-to-k6 postman-collection.json –o your-k6-script.js Install it using npm npm install –g postman-to-k6 Thanks to borjacampina for creating this tool. There is converter from Postman collection to k6 script that you can download here. If you want to go further, K6 also integrated well with, a SaaS solution for k6 results storage and analysis where you can look at the test in real time and also perform detailed result analysis. The result can show how many virtual users that are successfully made request, does it pass the threshold, or whether there is any error or not. You can simulate how many users that make request to the REST API with given duration and you can also set threshold of the acceptable response time. K6 is a modern load testing tools written in Javascript with concept of Virtual Users (VUs). Unfortunately, it still lacks of feature for load testing. ![]() It has some cool features manage the collection of HTTP/HTTPS request, export or import the collection into JSON and even store it in the cloud under our profile. POSTMAN is one of the best tools to test the functionality of a REST API. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |