Responsive

Master Continuous Testing with TeamCity + Testkube

December 20, 2024
:
4
:
59
Atulpriya Sharma
Atulpriya Sharma
Sr. Developer Advocate
InfraCloud Technologies
Share on X
Share on LinkedIn
Share on Reddit
Share on HackerNews
Copy URL

Table of Contents

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

You have successfully subscribed to the Testkube newsletter.
You have successfully subscribed to the Testkube newsletter.
Oops! Something went wrong while submitting the form.

Transcript

Hi there, and I'm Atul from Testkube. And in this video, we are going to see how to integrate Testkube with TeamCity, which is a popular CI/CD tool.

We will be using TeamCity Cloud in this. So we have created our account, and we would start by creating a new project in TeamCity. So once you log into the dashboard, you click on new project, and it gives you various options to create a new project. You can create using github.com, Bitbucket Cloud, GitLab, or try doing it manually. We would be choosing the relatively easier option by providing a repository link.

So here you can see the repo, which has just one k6 basics.yaml file.

Now we click on proceed and during this time, TeamCity will configure the VCS route that is required for it to connect to. And once you click on proceed, the new project will be created.

So TeamCity can automatically detect any pipeline code that is present in your repo. In this case, we don't have any, but we have already set up one. So I'll just show you how that works. So you click on build configurations and then you would be presented with a whole lot of settings that you can configure your pipeline to. So one of them is VCS roots. Again, this is something that is configured by default where you provide the git repository URL and then it configures all the branches that it needs to monitor.

The next important thing here is the build step. So this is basically the build step that you are going to add to your pipeline, and there are different options available. You will be choosing command line to use the test cube CLI. So in this case, if you click on edit since you already have a build step in place, you can see that we are first setting the test cube context where we are passing the test cube API token, environment ID, org ID, and then obviously running the Testkube command to execute the test workflow.

You can also see the image that we are using, which is Testkube CLI image, and we are running it in a Linux container.

To get access to the API tokens and environment and org ID, all you need to do is go to your test tube dashboard, click on the environment, and then you will get your environment and org ID from there. For the API token, you need to go to your organization settings, tap on API tokens, create a new token, and then copy that token and bring it to TeamCity.

In TeamCity, you need to configure these variables as parameters, essentially environment variables. So you can see we have added three of them here, test tube API token, environment ID, and or ID. So all the tokens and IDs that you get from there, you just create it here with this name and save it. So with this, your pipeline is already ready, and it's configured to trigger on any PR that would be raised.

So let us see this in action.

We go to the GitHub repo and try adding a new file. So in this case, let us just go ahead and add a readme file which is missing, give some content, and just commit the changes. So we say adding a new readme file, and then we say create a new branch. And there's a PR for that.

So in this case, here's the PR page, and we just click on create PR. Now the moment this happens, TeamCity is already configured to monitor slash watch this particular branch. So we would go back to TeamCity. It does take a few seconds to refresh, but then within some time, you will see that the pipeline has already triggered and you can see the status here as running.

So you can click on that to see the exact steps and the live build logs. So you can see here that it is setting up everything that is required. It also shows the PR on which this was triggered. So you can see the settings here.

You go to build log and you can see that it has already started executing the test workflow. Let's go to test view dashboard and here you can see that the test flow test workflow is already executed. So if you see here, the source is TeamCity, which means that this test workflow was deployed and triggered using TeamCity. You can click on run and upload artifact steps to know more about the test workflow.

Here are the complete build-ons and that is how you configure TeamCity to execute your test workflow.

So that's about it for this video on configuring Testkube with TeamCity.

Do check out our blog post and Testkube documentation to learn more.