node.js - 如何将 SonarQube 和 JMeter 与 AWS CodeBuild 集成
问题描述
我们如何将 SonarQube 和 JMeter 与 AWS CodeBuild 集成。
目前我们在 bitbucket 中使用源代码并使用 aws codebuild 构建代码。那么对于这个 cicd 进程如何设置 sonarqube 和 jmeter?
解决方案
根据JMeter 项目主页:
Apache JMeter™ 应用程序是开源软件,一个 100% 纯 Java 应用程序,旨在加载测试功能行为和测量性能。它最初是为测试 Web 应用程序而设计的,但后来扩展到其他测试功能。
因此,您需要一个Java VM实例才能运行 JMeter,因此您需要java
AWS CodeBuild 映像
运行 JMeter 有多种选择,但可能最简单的一种是使用JMeter Maven Plugin,如果您将拥有像这样的pom.xml 文件:
<?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>
并将您的 JMeter 测试放入src/test/jmeter
相对于 pom.xml 文件的文件夹中,您将能够使用 Maven n触发 JMeter 测试,如下所示:
build:
commands:
- mvn verify
推荐阅读
- google-cloud-platform - 有没有办法说明 Cloud DataStore 事务失败的原因?
- html - 用 SVG 形状替换剪辑路径形状
- ubuntu - Ubuntu lightdm.service does not exist
- android - 如何让自定义视图观察包含片段的生命周期事件而不是活动?
- reactjs - 如何在 Redux reducer 中保持之前的状态并为之前的状态添加新状态?
- uicollectionview - 未填充 collectionViewCell 的标签/图像视图出口的连接。(没有错误)
- azure-data-factory-2 - 通过 Azure 数据工厂将文件从 S3 迁移到 Azure 文件
- python - How to plot y-axis bands in Altair charts?
- c# - 如何在 MonoGame 中向 2D 中的鼠标位置缩放
- python-3.x - dataframe columns to multtindex dataframe