BreadcrumbHomeResourcesBlog What Is CircleCI Used For? Plus CircleCI and JMeter Integration Tips March 3, 2022 What Is CircleCI Used For? Plus CircleCI and JMeter Integration TipsOpen Source AutomationDevOpsBy Deyvis PedrosaCircleCI is emerging in popularity. But what is CircleCI used for? In this post we will be discussing the CircleCI platform. We will quickly introduce the tool and explain how to integrate it with open source JMeter so you can execute load tests in your CI process.Table of ContentsWhat is CircleCI Used For?Why Is CircleCI Important?How to Create Pipelines in CircleCIHow to Integrate CircleCI and JMeterTable of Contents1 - What is CircleCI Used For?2 - Why Is CircleCI Important?3 - How to Create Pipelines in CircleCI4 - How to Integrate CircleCI and JMeterBack to topWhat is CircleCI Used For?CircleCI is a continuous integration tool. CircleCI is used for building, testing, and deploying a project, by using automation. This automation takes place in pipelines with jobs. These jobs include: A pipeline is a set of instructions or steps that our CI tool will execute each time our code is updated.Jobs are a set of specific tasks for the building, testing and deploying stages. Each job is executed in a separate container or virtual machine.After completion, CircleCI sends an email notification. For example, notifying of the success or failure after performance tests complete. CircleCI also includes integrated Slack and IRC notifications. You can configure CircleCI manually as you please or you can choose from the many available “orbs” in its orb registry to reuse configurations and simplify your work.Back to topWhy Is CircleCI Important? Nowadays, it is rare to find a company that does not use a continuous integration (CI) approach in their development processes. In case you are not familiar with it, continuous integration is a practice that encourages developers to integrate their code early and often into a shared repository.CI tools can be configured to trigger your build and execute various sets of automated tests before merging. Depending on the configuration defined, they can even stop the integration if any failures are detected. This information will help the team identify issues early and fix them quickly, preventing bugs in your code. In other words, continuous integration improves team productivity, efficiency and confidence, so you can find problems and solve them quickly, to release higher quality and more stable products.There are many tools that can help us implement a continuous integration approach in the development of our products. CircleCI is one of them.Back to topHow to Create Pipelines in CircleCIWe will execute a JMeter testing script stored in a GitHub repository to test our application. You can access the repository used for this example here.To create a pipeline in CircleCI follow these simple steps:Step 1: Create a sample project in GitHub and upload your JMeter script there. Step 2: Login to CircleCI using GitHub Step 3a: Click on “Add Projects” Step 3b: Select the created project Step 3c: Select “Write your own config file” Step 3d: Select “Skip this step” Step 3e: Click on “Commit and Run” After this, your new pipeline will be triggered and a new branch will be created on your sample repository called “circleci-project-setup”.That branch will contain a “.circleci” folder and inside that folder a file called “config.yml”, which will be in charge of telling our pipeline which steps to execute. Up next we will break down that file to understand how it works. The config.yml fileYour config.yml file should look something like this. version: 2.1 jobs: say-hello: docker: - image: cimg/base:stable steps: - checkout - run: name: "Say hello" command: "echo Hello, World!" workflows: say-hello-workflow: jobs: - say-hello This sample configuration created by CircleCI has one simple step, that will print “Hello, World!” in the console. This is the default by CircleCI.Let’s break down the different sections of this file: In the next chapter we will tweak this config file to integrate our JMeter test to our pipeline. Back to topHow to Integrate CircleCI and JMeterIn the following screenshot you can see the modified config.yml file that will set up our pipeline. Let’s talk about what this file is meant to accomplish.ExecutorFirst of all, we need to be able to execute our JMeter script on CircleCI. One of the easiest ways to accomplish this is to use a Docker image as our executor, with JMeter already configured on it. What it means is that when running our circleci-jmeter job, it will have all the configuration needed to run the JMeter script. You can search and choose from all Docker images available on this link. We recommend choosing among the images latest updated. In this case, we decided to use an image called “justb4/jmeter” for this example, which is declared in item 1 on the screenshot.StepsAfter setting up the executor to run our tests, we need to set the test steps according to our needs. For this example, we will do it in the following way: Create a “results” folder as we see in item 2 on the screenshot.Run the tests using JMeter storing the results in a HTML report with the command seen in item 3 on the screenshot. (To learn more please visit this link.)Store the results on our pipeline run artifacts as we see done on item 4 on the screenshot. Lastly, we changed the job and workflow names in order to give more information about our pipeline’s steps and that’s it. We now have a fully functional pipeline that will trigger the execution of our JMeter script and automatically store its results. Results in CircleCINow, if we go back to our pipeline in CircleCI we will see the execution with all the changes that we made in the config.yml file. If we open a pipe execution and go to the Artifacts tab, we’ll find a file called “index.html” containing the test results. If you want to read more about the information shown in this HTML report visit this link.By following all these steps, you now have a basic CircleCI pipeline with a JMeter execution and a HTML report with the results.You can access the repository used for this example here.Try BlazeMeter, which runs JMeter tests easily and in the cloud and also integrates with CircleCI today!START TESTING NOW Back to top
Deyvis Pedrosa Automation Tester, Abstracta Inc. Deyvis is an Automation Tester who has been working at Abstracta for a year. During this time, he has participated in a few projects developing Performance testing and CI/CD skills. He has also contributed to Federico Toledo's blog by sharing research findings on the comparison between automation tools.