-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpom.xml
215 lines (198 loc) · 9.98 KB
/
pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<?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>maven</groupId>
<artifactId>jmeterMaven</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- <name>jmeter-maven</name>-->
<!-- <url>http://maven.apache.org</url>-->
<!--设置报告生成的路径-->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--此路径用于存储JMeter的原生测试结果文件,比如csv或者jtl-->
<jmeter.result.jtl.dir>${project.build.directory}/jmeter/results</jmeter.result.jtl.dir>
<!--此路径用于存储由模板转换过来的详细的测试结果的html文件-->
<jmeter.result.html.dir>${project.build.directory}/jmeter/html_detail_report</jmeter.result.html.dir>
<!--此路径用于存储由模板转换过来的测试结果的html文件-->
<jmeter.result.html.dir1>${project.build.directory}/jmeter/html_report</jmeter.result.html.dir1>
<jmeter.result.html.dir2>${project.build.directory}/jmeter/html_report2</jmeter.result.html.dir2>
<jmeter.result.html.dir3>${project.build.directory}/jmeter/html_report3</jmeter.result.html.dir3>
<ReportName>TestReport</ReportName>
<projectName>projectName</projectName>
</properties>
<!--依赖包-->
<dependencies>
<!--mysql驱动-->
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.71</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_java</artifactId>
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>jorphan</artifactId>
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_functions</artifactId>
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
<configuration>
<artifactId>mysql-connector-java</artifactId>
<outputDirectory>${project.build.directory}/jmeter/lib</outputDirectory>
</configuration>
</plugin>
<plugin>
<!--核心插件,用于将Apache JMeter集成到Maven中
https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/master/CHANGELOG.md-->
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.9.0</version>
<configuration>
<!--JMeter能够创建.jtl(XML格式)测试结果和csv测试结果。
默认情况下,此插件使用csv格式。这里需要将其切换为xml格式。-->
<resultsFileFormat>xml</resultsFileFormat>
<!--这里是否生成result report需要设置为false,否则运行时会出现“前言中不允许有内容”的报错。
因为若该项为true,无论你在.properties配置文件或者此pom文件中将结果文件的格式显示设置为xml,最后都只会生成csv的结果文件。
而csv的格式无法转换成我们最后要的html结果文件,就会报上述的错。-->
<generateReports>false</generateReports>
<!-- 设置忽略失败是否停止运行-->
<ignoreResultFailures>true</ignoreResultFailures>
<!--为结果文件添加时间戳-->
<testResultsTimestamp>true</testResultsTimestamp>
<appendResultsTimestamp>true</appendResultsTimestamp>
<resultsFileNameDateFormat>yyyyMMdd-HHmm</resultsFileNameDateFormat>
<!--指定日志级别-->
<overrideRootLogLevel>DEBUG</overrideRootLogLevel>
<testFilesIncluded>
<!--指定运行的jmeter脚本jmeter路径下-->
<jMeterTestFiles>script/${projectName}/*.jmx</jMeterTestFiles>
<!--指定不需要运行的jmeter脚本-->
<!--<testFilesExcluded>aaa.jmx</testFilesExcluded>-->
<!-- 指定jtl生成目录 -->
<!-- <resultsDirectory>${jmeter.result.jtl.dir}</resultsDirectory>-->
</testFilesIncluded>
<!--指定运行的jmeter脚本jmexml-maven-pluginter路径下,指定文件夹-->
<!-- <testFilesDirectory>${basedir}/src/test/jmeter/script/${projectName}</testFilesDirectory>-->
<!-- <testFilesDirectory>${basedir}/src/test/jmeter/script/商学院/</testFilesDirectory>-->
</configuration>
<executions>
<!-- 生成jmeter配置 -->
<execution>
<id>configuration</id>
<goals>
<goal>configure</goal>
</goals>
</execution>
<!-- 运行jmeter测试 -->
<execution>
<id>jmeter-tests</id>
<phase>verify</phase>
<!--脚本所在的文件夹 -->
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0.2</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<!--保存JMeter原生测试结果文件(.jtl文件)的路径-->
<dir>${jmeter.result.jtl.dir}</dir>
<!--需要解析的模板-->
<stylesheet>src/test/resources/jmeter-results-report_21.xsl</stylesheet>
<!--通过模板生成测试结果的html文件-->
<outputDir>${jmeter.result.html.dir1}</outputDir>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
<transformationSet>
<!--保存JMeter原生测试结果文件(.jtl文件)的路径-->
<dir>${jmeter.result.jtl.dir}</dir>
<!--需要解析的模板-->
<stylesheet>src/test/resources/jmeter.results.shanhe.me.xsl</stylesheet>
<!--通过模板生成测试结果的html文件-->
<outputDir>${jmeter.result.html.dir}</outputDir>
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>saxon</artifactId>
<version>8.7</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<defaultGoal>clean</defaultGoal>
</build>
</project>