
Introduction to the course. What the student should expect by the end of the course? Go through all sections describing what will be executed.
Prerequisites to set up a fully functional development environment.
Links to external resources (tools) are added in this lecture.
Set up a cluster to be able to deploy services in a local environment
What is Load Testing in general?
What about load requirements?
One of the difference between load tests and other testing types is how we define error conditions.
What are the different types of load tests and how they can be best described using throughput and duration of each test?
Is load testing same as performance testing?
What are the myths behind load testing?
Complex software architectures makes it difficult to predict failure modes under extreme load. This is the reason that we need to implement and integrate a testing process as early as possible in the development cycle.
k6's approach is different. k6 is best used for continuous, iterative testing.
See, when you think of testing as an activity done at the end of every release, it's a heavy lift - something that requires a lot of upfront effort - and one that is completed before the release goes live.
Instead, the k6 way of testing is more like rolling a snowball. You start small, addressing the most pressing issues or risks, and ship it by pushing it down the hill. As it falls, however, it picks up steam– just like your test suite should grow alongside your application.
What are the few characteristics that Grafana k6 has that makes it stand out from other load testing solutions?
Everyone says that reliability is the most important feature. Is that true? What is true is that it is hard nowadays!
xk6-disruptor is an extension that adds fault injection capabilities to k6. It implements the principles of the Chaos Engineering discipline to test the reliability of our applications under turbulent conditions such as delays and response errors.
Key features include:
Everything as code. Facilitate test reuse and collaboration between teams without learning a new DSL.
Fast to adopt with no day-two surprises. No need to deploy and maintain a fleet of agents or operators.
Easy to extend and integrate with other types of k6 tests. No need to try to glue multiple tools together to get the job done.
Why reliability is hard and what are the key ingredients of the chaos engineering?
Explore the steep curve of chaos engineering, highlighting the high adoption bar, experiments in production, unpredictability, side effects, and the need for strong infrastructure knowledge.
Shift left chaos testing injects faults early to verify resilience before deployment. Learn chaos engineering principles, including fault injection, latency studies, and chaos as code with incremental, application-centric practices.
Fork and clone the repo to boot chaos testing with docker compose (quick pizza, Prometheus, Grafana), then run your first k6 test against the pizza API and log metrics.
Learn how virtual users and iterations drive k6 load tests, configure options for threads and duration, and use stages to ramp up, peak, and ramp down for realistic scenarios.
Add checks to your K6 scripts to validate responses, including status 200, body content, and negative cases, enabling basic API functional testing and more reliable resilience checks.
Define and apply thresholds as pass/fail criteria for test metrics, using the 95th percentile of HTTP request duration to abort tests and trigger alerts.
In this lecture we are going to learn how to :
Use Prometheus as an output in K6
Use Grafana to visualise that output coming from K6
Use execute K6, Prometheus & Grafana
In this lecture we are reviewing the four distinct lifecycle stages and why they are important for test execution.
In this section we are going through different type of metrics k6 supports and provide practical examples.
Implement custom reporters to visualize test metrics, generate a json summary, and enable a local web dashboard with k6, transforming data into html or other formats for reporting.
We successfully build our very first web service and deployed to local k8s. The service is get current timestamp API.
Structure to be added:
deployment.yml
service.yml
main.go
go.sum
go.mod
Dockerfile
We successfully build our consumer API service.
Structure to be added:
deployment.yml
service.yml
main.go
go.sum
go.mod
Dockerfile
Learn how to install k6 and the xk6-disruptor module, set prerequisites, and prepare a binary or release from GitHub to inject faults into macroservices.
Now let’s implement the chaos testing scenarios. We will try to inject faults to the get current timestamp API using ServiceDisruptor and see how the consuming API responds to those injection faults.
To make the consuming API more stable and fault-tolerant, we need to apply a retry mechanism for the consuming API so that when it receives the 500 status code from the get current timestamp API, it will try to make another request.
Concludes chaos testing principles with performance and load testing insights, Go-based microservice fault injection in a local Kubernetes cluster, and the aim to make chaos engineering accessible via Grafana k6.
Introduction
Software testing is essential to ensure that your software application performs as expected.
No doubt about it!
But even if your application runs smoothly in a testing environment, unexpected incidents can occur in production, such as a crashed database or a lost connection to a third-party service. To ensure your application can handle such incidents and minimize their impact, you need to incorporate chaos testing into your delivery process.
In this course, we will start with a brief introduction to k6 for backend performance testing and we’ll explore how to implement chaos testing using k6 for backend services, to help you ensure the resilience of your application.
What is chaos testing?
Chaos testing is a software testing methodology that involves intentionally injecting faults and disruptions into your application to identify its weaknesses. It is often used with other testing methodologies, such as functional, load, and performance, to ensure your application’s overall quality and reliability.
Why implement chaos testing?
Chaos testing ensures that your application can withstand unexpected failures and disruptions in a production environment. By simulating different scenarios and failure modes, you identify potential issues in your app and develop solutions to resolve them.
What is k6?
k6 is a load-testing tool for checking that your application can withstand the expected workload. Besides a load testing tool, k6 provides experimental features to apply chaos testing using xk6-disruptor extension. To do that, you write chaos testing scenarios in JavaScript.