Everything you need to start load testing with k6. Covers the core concepts - virtual users, stages, checks, and thresholds - then puts them into practice by testing a live REST API.
You'll learn how to define custom metrics, tag requests for granular analysis, use setup/teardown hooks, and set performance SLAs that fail your test if they're not met.
Length 42:23
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #k6 #load testing #javascript #nestjs #api performance #software development #automation #grafana #testing tools
0:00 Hey, everyone. Today I'm super excited to bring you a new 0:03 lecture on 0:04 k6. Now, if you've never heard or used k6 0:08 before, it is a load testing tool from 0:11 Grafana, and it is my favorite go-to load testing 0:15 tool these days because of the amazing developer experience around 0:19 it, as well as the portability. So with k6, 0:23 we have a dedicated binary that we install and run 0:28 just regular JavaScript. So that's one of the big benefits 0:31 is we just 0:32 write normal JavaScript and use the k6 binary to 0:36 write it. So you can see here 0:38 in the example that we're literally just writing JavaScript, which is 0:42 really nice as opposed to something like Artillery where we're configuring 0:45 everything with YAML. Well, now when you write your code inside 0:49 of JavaScript or TypeScript, your load tests are gonna be just the 0:53 same. 0:53 And so I really like this approach. 0:55 Now, another great benefit of k6 is that it runs essentially 0:59 anywhere and you have really nice reporting to 1:03 actually see your results. And so in this lecture, 1:06 we're gonna walk through 1:07 writing a k6 load test for a NestJS 1:11 backend. So I'm super excited to jump in. 1:13 By the end of this lecture, you'll be able to write your own k6 load 1:16 tests for your 1:17 applications and make sure your application is fully performant. 1:21 So let's go ahead and jump right in. 1:22 Now, like all my lectures, I'll leave a link below where you can get 1:26 access to the 1:26 full project code. Starting off here, we have a basic starting 1:30 application, and so let's walk through it. 1:32 I just have a pnpm 1:34 workspace set up to set up two packages, one API 1:38 and one k6, which we'll set up shortly. 1:41 And we have our root package.json here, which is completely empty.
The rest of the transcript is for members.
Sign in