100 lines
2.3 KiB
Markdown
100 lines
2.3 KiB
Markdown
## Maven 依赖
|
|
|
|
```Plain Text
|
|
<dependency>
|
|
<groupId>junit</groupId>
|
|
<artifactId>junit</artifactId>
|
|
<version>4.12</version>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
```
|
|
|
|
```Plain Text
|
|
<dependency>
|
|
<groupId>com.github.houbb</groupId>
|
|
<artifactId>junitperf</artifactId>
|
|
<version>1.0.3</version>
|
|
</dependency>
|
|
```
|
|
|
|
|
|
|
|
## Maven 插件
|
|
|
|
```Plain Text
|
|
<plugin>
|
|
<artifactId>maven-assembly-plugin</artifactId>
|
|
<configuration>
|
|
<descriptor>assembly.xml</descriptor>
|
|
<archive>
|
|
<manifest>
|
|
<mainClass>racal.sunyard.main.Version</mainClass>
|
|
</manifest>
|
|
</archive>
|
|
<descriptorRefs>
|
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
|
</descriptorRefs>
|
|
</configuration>
|
|
<executions>
|
|
<execution>
|
|
<phase>package</phase>
|
|
<goals>
|
|
<goal>single</goal>
|
|
</goals>
|
|
</execution>
|
|
</executions>
|
|
</plugin>
|
|
```
|
|
|
|
|
|
|
|
```Plain Text
|
|
<assembly
|
|
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
|
|
<id>fat-tests</id>
|
|
<formats>
|
|
<format>jar</format>
|
|
</formats>
|
|
<includeBaseDirectory>false</includeBaseDirectory>
|
|
<dependencySets>
|
|
<dependencySet>
|
|
<outputDirectory>/</outputDirectory>
|
|
<useProjectArtifact>true</useProjectArtifact>
|
|
<unpack>true</unpack>
|
|
<scope>test</scope>
|
|
</dependencySet>
|
|
</dependencySets>
|
|
<fileSets>
|
|
<fileSet>
|
|
<directory>${project.build.directory}/test-classes</directory>
|
|
<outputDirectory>/</outputDirectory>
|
|
<includes>
|
|
<include>**/*.class</include>
|
|
</includes>
|
|
<useDefaultExcludes>true</useDefaultExcludes>
|
|
</fileSet>
|
|
</fileSets>
|
|
</assembly>
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## 使用
|
|
|
|
使用 `xxx-fat-tests.jar` 测试类 `TestCIPSPref0`
|
|
|
|
|
|
|
|
执行脚本
|
|
|
|
```Plain Text
|
|
timeout /nobreak /t 5
|
|
C:\j2sdk-image\bin\java -Dip=192.168.5.8 -Dfile.encoding=utf-8 -cp .\xxx-fat-tests.jar org.junit.runner.JUnitCore TestCIPSPref0
|
|
@pause
|
|
```
|
|
|