Cloud-Native Test Orchestration
In my previous article, we learned the working logic of testkube by making an example with k6. In this article, I will show you how to make the orchestration aimed by testkube.
Testkube Executors
There are a few important points we need to learn about testkube before we move on to orchestration processes.
Testkube currently works with executors. These executors make our tests run by adapting them in the Kubernetes environment in the back to make our tests run. Since many tools and frameworks are used today, some are officially supported now. These are the most common tools we use in the testing and development world such as k6, cypress, postman, SoapUI, maven, gradle, cURL, KubePug, and Ginkgo. Apart from these, there is no need to worry if there is any executor that you want to use but is not on this list. Testkube has lovely documentation and a system allowing you to create a custom executor.
Testkube Test Suites
We used only k6-executor in our previous article, now we will add cypress to it. Thus, we will create a test suite and run our performance and UI tests under a single suite. So what is this test suite, test suite allows us to run the tests we created on testkube under a single suite. So this means that before you create a testsuite, you need to have tests created with testkube. Let’s start with an example, first I will create a test for k6, and then I will create it for cypress.
To create a test for k6, I’ve added a simple js file beforehand and using it I’m creating my test with the simple testkube command.
kubectl testkube create test -f test.js — name testkube-k6 — type k6/script
Now it’s my turn to create a test for cypress. I will use testkube’s example repository for this.
I want to mention an important point here, this is one of the cons that I see, if you want to create a test for cypress, your code must be on github, like normal k6, it cannot detect the project from local. I hope there will be support for local files in the future.
As you can see in the command below, we add the repository link via git-URI, then we need to specify the path of whichever path our tests are under, and finally, we add cypress/project as the type and run our command.
kubectl testkube create test — git-uri https://github.com/kubeshop/testkube-executor-cypress.git — git-branch main — git-path examples — name testkube-cypress — type cypress/project
Now my tests are ready for both cypress and k6. In order to check whether my tests are formed properly, I list and check our tests with the following command.
kubectl testkube get tests
Our tests are done properly now it’s time to create a test suite. We need a JSON file to create a test suite. This JSON file contains the name, description and steps of our test suite. We need to give you which testkube test you need to execute in the steps. We use the names of the tests we created above.
After creating our JSON file, we now need to create a test suite. When creating Testsuite, you must provide the JSON file and name you created as the file.
kubectl testkube create testsuite -f testkube.json — name testkube-suite-example
Now let’s check if our test suite is formed correctly. We will use the same command that we used when checking our tests above, in fact, we will only get test suites instead of the test as type.
kubectl testkube get testsuites
Yes, we see that our test suite has formed properly, now it’s time for the magic. Let’s run our test suite and see what’s going on.
kubectl testkube run testsuite testkube-suite-example
We see the details of our test suite on the terminal.
I’ll show you the execution details output. As you can see, all of our steps have worked without any problems and we see that has passed.
So, where do we get the detailed metrics, testkube provides us with a dashboard, if you want, we can use the dashboard or you can access the execution details it offers us by sending a message on slack. In my next article, I will be with you on sending testkube dashboard and metrics to slack.
Waiting for your comments here, LinkedIn or Twitter and if you liked the article, you can let me know with applause. 🫡