Responsive

Getting Started with Testing in Kubernetes Using Testkube

Dec 6, 2022
7 min
read
Alejandra Thomas
Developer Advocate
Testkube
So you've transitioned into Kubernetes, now what? It's easy to overlook testing, especially when in a cloud-native environment. Luckily for us, Testkube is here to help.
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on HackerNews
Copy URL

Table of Contents

Want to learn more about this topic? Check out our Office Hours session...

Start Using Testkube with a Free Trial Today

Subscribe to our monthly newsletter to stay up to date with all-things Testkube.

Dec 6, 2022
7 min
read
Alejandra Thomas
Developer Advocate
Testkube
So you've transitioned into Kubernetes, now what? It's easy to overlook testing, especially when in a cloud-native environment. Luckily for us, Testkube is here to help.
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on HackerNews
Copy URL

Table of Contents

Whether you're a tester, developer, or product owner, you know the importance of testing code to ensure good quality when building a product. When Kubernetes comes into the mix, the need for thorough testing becomes even more crucial, but many challenges follow suit.

Now, as more companies and organizations shift to using Kubernetes, it's more important than ever to find solutions that simplify its adoption. Instead of breaking your head trying to navigate through pods for your logs or having to spend a dozen hours and money getting trained on Kubernetes, it's time to find solutions that do the heavy-lifting for you.

When it comes to testing, that's where Testkube comes in:

Testkube is cloud native testing framework for testers and developers. It acts as an executor to orchestrate, run, and display tests and test results for your code in a Kubernetes environment. Whether you're new to the K8s ecosystem or a seasoned pro, Testkube lets you focus on testing without having to complicate yourself, your processes, or your pipelines.

In this article, I'll show you how easy it is to set up and get started with Testkube, no matter where you're at in your Kubernetes journey, Let's dive into it!

Getting Started With Testkube

Getting started with Testkube is straightforward. Simply head to the Getting Started page and choose one of the options:

  • Cloud: The control plane is hosted on testkube.io, and we manage the storage of your test results & artifacts.
  • On-Prem: You host the control plane and manage the storage of test results & artifacts.

Regardless of what option you choose, your tests always run inside your Kubernetes clusters; you just choose where to host the control plane. Let's see how to install Testkube and get started.

Cloud Installation

The easiest way to get started is to set up Testkube on the cloud. Simply head to Testkube and log in using your GitHub account.

Once logged in, you must create an environment and configure the Testkube agent on a Kubernetes cluster. 

Run the generated testkube pro init command in your terminal to install the Testkube Agent. In the image below, we configure the Testkube agent on a local kind cluster. 

With this, you’ve successfully configured Testkube to run on your cluster with the control plane hosted on Testkube.

On-Prem Installation

To install Testkube in your environment, you must have a Kubernetes cluster up and running. Once you have the cluster, you'll go ahead and install Testkube.

Install the Testkube CLI and validate the installation by running the testkube version command. 

$testkube version
Client Version 2.1.9
Server Version  api/GET-testkube.ServerInfo returned error: problem: error authenticating user via oidc
Commit 3e4f35d89c4b45824b5fc0e2ecefd5f3dbc17b5e
Built by goreleaser
Build date 2024-09-04T10:49:22Z

Request a trial license at https://testkube.io/download and you will get a license key in your email that is required to configure Testkube.

Run the testkube init demo command in your terminal and provide the license key that you received via email along with other details asked for.

Run the testkube dashboard command to open Testkube.

Log in to Testkube with the credentials, and you have successfully deployed Testkube on your on-prem cluster and have the dashboard up and running.

Check our installation docs if you run into any issues!

Testkube capabilities

Testkube is a cloud native testing framework that allows you to create testing workflows in a declarative, version-controlled manner. It allows you to plug in any testing tool and leverage the power of Kubernetes.

Below are some benefits of using Testkube:

  • Simplified Workflow Creation: Without complex scripting, Testkube facilitates the creation of detailed test workflows, allowing for better control and customization of test executions. Refer to our Test Workflows documentation to learn more. 
  • Kubernetes Native: By storing tests as Kubernetes Custom Resource Definitions (CRDs), Testkube ensures compatibility and scalability.
  • Integration with Testing Tools: Testkube integrates with various popular testing tools, including Cypress and Playwright. 
  • Integration with CI/CD Tools: Testkube seamlessly integrates with existing CI/CD pipelines, enhancing end-to-end testing capabilities.

Creating and running test workflows

Testkube comes with support out-of-the-box for several testing tools, including k6, Postman, Cypress, Gradle, and Maven (see the full list here). For this tutorial, I'll show you how to create a very simple k6 test workflow.

The easiest way to create a new Test Workflow is to use the Testkube dashboard. Login to Testkube, navigate to the Test Workflows tab and click the “Add a new test workflow” button.

This will provide you with four options:

  • Create from Wizard - use the wizard to create a Test Workflow.
  • Start from an example - use existing k6, cypress, and playwright examples
  • Combine existing workflows - use with existing workflows.
  • Import from yaml - import your own Test Workflow.

We’ll choose the “Start With An Example” option. You’ll be presented with a set of test workflows from which you can choose.

We’ll choose the default k6 test workflow present here. The wizard shows you the complete test workflow specification as well. 

Click on Create & Run to create and execute the test workflow.

Our test workflow will immediately start running, and Testkube will show the status along with a diagrammatic representation of the workflow and the associated steps. You can navigate to the executions tab once the test workflow has been executed to view more details about the execution and the associated logs and artifacts.

Once you’re past the initial setup, you’re ready to focus entirely on testing without handling Kubernetes intricacies, which is perfect for testers or developers at any level or point.

Now that we ran our first test, what else can we do with Testkube?

Next steps

Setting up Testkube with your CI/CD pipeline

There are different ways to integrate Testkube with your CI/CD pipeline. You can directly use the command-line interface, or if you use GitHub, you can create GitHub actions.

If you’re working with ArgoCD, you’ll need to add Testkube as a plugin and configure ArgoCD to manage the tests in your cluster. You can read more about how to do this here.

Conclusion

Testing cloud-native applications can be a little more challenging than testing traditional applications, but it doesn’t have to be difficult to get started. In times when Kubernetes continues to be adopted by hundreds of organizations around the world, tools like Testkube allow for an easy transition for you and your teams.

With Testkube, it’s possible to stem away from the fear of testing in Kubernetes and simply focus on improving the quality of your software - avoiding costly errors and bugs in the long run!

Give it a go!

Why not give it a go yourself? Sign up for Testkube and try one of our examples or head to our documentation. If you get stuck or have questions, we’re here to help! Find an answer to your questions in the Testkube Knowledge Base or reach out to us on Slack. We’re eager to hear how you use our integrations.

Alejandra Thomas
Developer Advocate
Testkube
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on HackerNews
Copy URL