user10870780
user10870780

Reputation:

How to Integrate SonarQube and JMeter with AWS CodeBuild

How do we Integrate SonarQube and JMeter with AWS CodeBuild.

Currently we are using source code in bitbucket and build code using aws codebuild. So for this cicd process how to setup sonarqube and jmeter?

Upvotes: 0

Views: 699

Answers (1)

Dmitri T
Dmitri T

Reputation: 168147

As per JMeter Project main page:

The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

So you need an instance of Java VM in order to be able to run JMeter hence you will need java AWS CodeBuild image

There are several options of running JMeter, but probably the easiest one is using JMeter Maven Plugin, if you will have pom.xml file like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>untitled</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <!-- Generate JMeter configuration -->
                    <execution>
                        <id>configuration</id>
                        <goals>
                            <goal>configure</goal>
                        </goals>
                    </execution>
                    <!-- Run JMeter tests -->
                    <execution>
                        <id>jmeter-tests</id>
                        <goals>
                            <goal>jmeter</goal>
                        </goals>
                    </execution>
                    <!-- Fail build on errors in test -->
                    <execution>
                        <id>jmeter-check-results</id>
                        <goals>
                            <goal>results</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

and put your JMeter test(s) into src/test/jmeter folder relative to the pom.xml file you will be able to trigger a JMeter test using Maven as simple as:

build:
 commands:
   - mvn verify

Upvotes: 2

Related Questions