Testkube

Testkube

What is TestKube?

  • TestKube is a Cloud-Native testing framework focused on Kubernetes made for testers and developers, It is capable of taking and working on all sorts of existing testing, like from postman, k6, and Cyprus (many more to be added, but we can provide them via executes) and will execute the test from inside the Kubernetes cluster, Instead of running them from outside as TestKube provides entire infrastructure for this.
  • TestKube Can be easily Integrated with GitOps and CI/CD workflows and provides us with a centralized test result.
  • So basically if you are not super technical knowledge about Kubernetes, TestKube frameworks make it easy for anyone as a tester or team to run Integration Tests seamlessly.
  • TestKube Decouples the testing activities performed at CI/CD pipeline and defines them in Testkube so that we can run our tests anytime without having to run the entire CI/CD pipeline for running an individual test, So moving across CI/CD platforms becomes more accessible as we don't need to redefine all the tests as we can just reuse the way tests has been defined and orchestrated in TestKube.
  • It also helps in managing test results more consistently for any tests, aggregates them all, and provides better Insights and analytics to observe the performance across different areas, like which area is underperforming or which area is slow and has some quality issues, and many things relevant in a larger engineering team, So centralizing the test result provides better Idea, which was not easy before TestKube.
  • It is very user-friendly and is easy to get started with.
  • The major highlight is its open source and is MIT-licensed.

Workflow with TestKube

CI/CD with.png

Workflow without TestKube

CI/CD without.png

  • So you don’t need to do any complex configuration to run your tests, TestKube fetches the test files from the project repo and executes them as you would like.
  • The complexities Involved with CI/CD in terms of testing are simplified as TestKube Manages all the testing activities itself.
  • TestKube provides entier infrastructure for taking care of all testing workloads from inside the Kubernetes cluster only.

How To Identify If TestKube is for you?

  • If you are doing Integration testing for your application under Kubernetes, Testkube is for you.
  • If your testing activities are too tightly coupled with your CI/CD.
  • If you want a consistent approach to your test results.
  • If you want to find a way around K8s restrictions like network restrictions or no access to test environments.

Installation & Getting Started

  • you can visit here for the detailed installation guide for your respective system
  • you can also watch the video installation guide here

After Installation, you shall see this screen

first.png

Now you will be able to be TestKube components in your cluster

second.png

After successful setup of components on the cluster you will be able to see both client and server versions

third.png

💡 Since TestKube is installed in an empty cluster we will need some service to test

Run your tests four.png

Have a glance at TestKube in Action here: 👇️source testkube-intro.gif

🤞you can look into the getting started guide here


Example Use Case: Load testing in Kubernetes using K6 and TestKube

  • Step 1: Get TestKube Installed guide
  • Step 2: Create your K6 load test and run it, you can follow this guide to write your testing script.Let's have a look onto an example script here 👇️
    import http from 'k6/http';
    import { check, sleep } from 'k6';
    export const options = {
    stages: [
     { duration: '5s', target: 20 },
     { duration: '5s', target: 10 },
    ],
    };
    export default function () {
    const res = http.get('https://httpbin.test.k6.io/');
    check(res, { 'status was 200': (r) => r.status == 200 });
    sleep(1);
    }
    
    save the file as k6-test.js, or anything you like.
  • Step 3: Now execute the test script. First, we need to define it as “k6/script” :
$ kubectl testkube create test --file path/to/your/k6-test.js --type "k6/script" --name k6-test

Then run it as

$ kubectl testkube run test k6-test -f

Now view your logs and test results in TestKube's dashboard just do

$ kubectl testkube dashboard

6294e6850accfdee52063dcf_bt5H4Ta1NJrofNOD9mk2gIUuW6bK-Va8-lngSxwRy-aA5SkTgpCHrncaGqbPgF3bx_DYO6IqRfNu6AkvxxEKpouWi2ulEZJifApFMpjeg4nU30WJZZd76Z4pfWNIsLl85905upkx_XLT_Tbn8g.png

Reference:

  • Open Source Cafe with kunal link
  • Official doc link
  • Use Case link