Testing becomes crucial as the complexity and the adoption of a solution grows. In Kubecon NA 2020, Jian from Airbnb talked about 10 more weird ways to blow up your Kubernetes. The first key takeaway from the talk was to test the new features on test clusters. But how does one ensure adequate testing without adding significant time to build or deploy pipelines?
To do so, here are two preliminary tests that have to be performed by a team before moving their solution to a production environment:
Testing for both of these scenarios ultimately requires time and resources, which is where parallel testing is a powerful approach to ensuring your system is tested at scale before it goes into production. In this post, we will understand the concept of test parallelisation and some of the common approaches like load and functional parallelisation. We will discuss in depth some of the challenges associated with those approaches, and explore a Kubernetes native testing framework that can help us address those challenges.
Parallel Testing is the process of performing parallel simulations and tests to validate the functionality and performance of the application under test. Parallelisation is done to both scale the performance under load, and perform functional analysis of the system under test to increase coverage and decrease overall test execution times. Let us understand load and functional parallelisation in detail.
To test a solution for peak-hour performance, creating a load by sending multiple requests from a few anonymous users is not enough. We are required to simulate a real-time environment by generating a massive load from named users from multiple geographies, possibly across multiple browsers or devices.
Parallel load testing is the process of using parallel instances of load-testing tools to simulate a massive number of users from multiple nodes, possibly distributed across geographic locations. Solutions that face large volumes of concurrent users, such as social media platforms, banking applications, e-commerce websites, online gaming applications, etc. can all benefit from this approach to testing to ensure uninterrupted services for their users even under peak usage.
Enabling load parallelisation has some challenges, let us understand these.
Parallel functional testing is the process of performing parallel functional tests to increase test coverage and decrease overall test execution time. It is commonly paired with parameterised test execution by giving a specific input and checking to get the expected output. For example, using the browser version as input, we can test a feature across multiple browsers or operating systems in parallel and at the same time. This would not only help us with time to market but would also allow efficient testing and optimized usage of resources. In the coming section, we are going to talk about the need for functional parallelisation with the help of an example.
For example, we have a banking solution for which we want to make two-factor authentication mandatory for all users at the time of sign-in. Now testing this functionality across multiple browsers sequentially would not only take a lot of time but also resources. Here the input would be a parameterized user for which the two-factor authentication is enabled and happens successfully in a minimal amount of time.
With functional parallelisation, we can test this functionality with various inputs across multiple browsers at the same time. Suppose the test fails for any of the browsers, we would get to know in a lot less time and work on identifying the root cause along with its solution.
Enabling functional parallelisation also has some challenges, let us understand these.
Seeing the challenges associated with load and functional parallelisation, we need a testing solution that automates testing with parameterized virtual users or other inputs across multiple browsers or operating systems simultaneously. Also, the solution should allow dynamic resource allocation based on test requirements and optimize resource utilization. For systems under test, the testing solution should provide real-time visualization of tests and aggregated results to perform result analysis.
Testkube recently introduced Test Workflows, which leverages an execution and orchestration engine specifically built for executing any testing tools and scripts at scale, and since Testkube leverages Kubernetes as its runtime environment for test execution, it can scale and allocate resources for test execution in line with corresponding functionality provided by Kubernetes itself.
Test Workflows are defined using a dedicated YAML vocabulary, and can be created using both extensive Wizards and samples for different scenarios which can then be further enhanced in any way required to fulfill your testing requirements using the Testkube Workflow Editor. Workflows also give fine-grained control over resource-usage and allocation for your tests, helping you maximize the utilization of your infrastructure for test execution.
Parallel testing is one of the many functionalities available via Workflows:
As described above, running a load test from multiple nodes in parallel is often required to simulate large amounts of user traffic. The parallel keyword in Test Workflows allows you to parallelize any load-testing tool or script for this purpose, for example:
Examples for distributed load-testing with several of these tools are available in the Testkube Documentation.
Parallelising functional and end-to-end (E2E) tests for the purpose of increased test coverage and reduced overall test execution times is equally well supported by the parallel keyword. Depending on the testing tool you are distributing, you can also shard test files or input parameters across nodes, which is supported by the shard keyword, for example
As above, examples for distributed functional testing with these tools are available in the Testkube Documentation.
The approaches described above with the parallel and shard keywords are meant to be used within a single workflow. If you on the other hand want to combine multiple workflows to run either in sequence or in parallel you can use the execute keyword to orchestrate the execution of any other workflow in any combination required. For example you can:
Read more about Composite Testing in Introducing System Testing with Testkube and about the execute keyword in the documentation.
Testkube automatically captures the log output of any testing tool it runs on all nodes the tools are running on, to help you ensure that tests were executed as desired and debug issues with your executions. Furthermore, Testkube can be configured to capture any artifacts produced by your tests, including aggregate reports, videos, JUnit-reports, etc. When captured, Testkube will make these available via the Dashboard.
Testing your applications at scale often requires a parallelised execution approach to your testing efforts, be it the parallelisation of load-tests to generate massive load, or the parallelisation of functionali/E2E tests to increase test coverage and improve test execution times.
The recently introduced Test Workflows engine in Testkube allows for parallelisation of any testing tool, both load and functional, with additional support for sharding, parameterisation and management of dependent services to execute your tests.
Head over to testkube.io/get-started to learn more and give Testkube a try using either our demo environment or your existing tests running in your own infrastructure.
Testkube is a test execution and orchestration framework for Kubernetes that works with any CI/CD system and testing tool you need, empowering teams to deliver on the promise of agile, efficient, and comprehensive testing programs by leveraging all the capabilities of K8s to eliminate CI/CD bottlenecks, perfecting your testing workflow. Get started with Testkube's free trial today!
Related topics: