java 性能測試框架工具-junitperf
阿新 • • 發佈:2018-07-24
mas lang 1.7 ogr art 技術分享 hello 圖片 success 性能測試工具
對於 Java 開發者來說,要去學習性能測試工具未免很麻煩。
但有時候會有性能測試的需求。
junitperf
junitperf 就是一款為 Java 開發者設計的性能測試框架,如果你會 Junit,很容易就可以學會。
特性
-
支持 Junit4+JDK1.7+,入門簡單 (@since 1.0.0)
-
支持 Junit5+JDK1.8+,使用方便 (@since 2.0.0)
-
支持 I18N
- 性能報告支持自定義拓展
使用例子
入門案例
入門案例地址
- jar 包引入
<dependency> <groupId>com.github.houbb</groupId> <artifactId>junitperf</artifactId> <version>2.0.0</version> </dependency>
- 使用例子
import com.github.houbb.junitperf.core.annotation.JunitPerfConfig;
public class HelloWorldTest {
@JunitPerfConfig(duration = 1000)
public void helloTest() throws InterruptedException {
Thread.sleep(100);
System.out.println("Hello Junit5");
}
}
測試結果
日誌形式
[INFO] 2018-01-14 22:16:31.419 [] - Started at: 2018-01-14 22:16:30.194 [INFO] 2018-01-14 22:16:31.419 [] - Invocations: 10 [INFO] 2018-01-14 22:16:31.420 [] - Success: 10 [INFO] 2018-01-14 22:16:31.420 [] - Errors: 0 [INFO] 2018-01-14 22:16:31.420 [] - Thread Count: 2 [INFO] 2018-01-14 22:16:31.421 [] - Warm up: 0ms [INFO] 2018-01-14 22:16:31.421 [] - Execution time: 1000ms [INFO] 2018-01-14 22:16:31.421 [] - Throughput: 10/s (Required: -1/s) - PASSED [INFO] 2018-01-14 22:16:31.424 [] - Min latency: 200.2112ms (Required: -1.0ms) - PASSED [INFO] 2018-01-14 22:16:31.424 [] - Max latency: 205.67862ms (Required: -1.0ms) - PASSED [INFO] 2018-01-14 22:16:31.425 [] - Ave latency: 202.97829ms (Required: -1.0ms) - PASSED
HTML 形式
java 性能測試框架工具-junitperf