All Projects → houbb → Junitperf

houbb / Junitperf

Licence: apache-2.0
⛵️Junit performance rely on junit5 and jdk8+.(java 性能测试框架)

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Junitperf

Jmeter Elasticsearch Backend Listener
JMeter plugin that lets you send sample results to an ElasticSearch engine to enable live monitoring of load tests.
Stars: ✭ 72 (-16.28%)
Mutual labels:  performance, performance-analysis, performance-testing, jmeter
Quickperf
QuickPerf is a testing library for Java to quickly evaluate and improve some performance-related properties
Stars: ✭ 231 (+168.6%)
Mutual labels:  performance, performance-analysis, performance-testing, junit
Speedracer
Collect performance metrics for your library/application.
Stars: ✭ 1,868 (+2072.09%)
Mutual labels:  performance, performance-analysis, performance-testing, performance-metrics
Inspectit
inspectIT is the leading Open Source APM (Application Performance Management) tool for analyzing your Java (EE) applications.
Stars: ✭ 513 (+496.51%)
Mutual labels:  performance, performance-analysis, performance-testing, performance-metrics
Dynamometer
A tool for scale and performance testing of HDFS with a specific focus on the NameNode.
Stars: ✭ 122 (+41.86%)
Mutual labels:  performance-analysis, performance-testing, performance-metrics
Deli
Stars: ✭ 148 (+72.09%)
Mutual labels:  performance, performance-analysis, performance-testing
Myperf4j
High performance Java APM. Powered by ASM. Try it. Test it. If you feel its better, use it.
Stars: ✭ 2,281 (+2552.33%)
Mutual labels:  performance, performance-analysis, performance-metrics
Lighthouse Batch
Run Lighthouse analysis over multiple sites in a single command
Stars: ✭ 83 (-3.49%)
Mutual labels:  performance, performance-analysis, performance-metrics
docker-google-lighthouse-puppeteer
Google Lighthouse + Puppeteer / Docker Image
Stars: ✭ 29 (-66.28%)
Mutual labels:  performance-metrics, performance-analysis, performance-testing
doc
QuickPerf documentation: https://github.com/quick-perf/doc/wiki/QuickPerf
Stars: ✭ 22 (-74.42%)
Mutual labels:  junit, performance-analysis, performance-testing
JUnitPerf
API performance testing framework built using JUnit
Stars: ✭ 48 (-44.19%)
Mutual labels:  junit, performance-analysis, performance-testing
Nemetric
前端性能指标的监控,采集以及上报。用于测量第一个dom生成的时间(FP/FCP/LCP)、用户最早可操作时间(fid|tti)和组件的生命周期性能,,网络状况以及资源大小等等。向监控后台报告实际用户测量值。
Stars: ✭ 145 (+68.6%)
Mutual labels:  performance, performance-analysis, performance-metrics
React Pinpoint
An open source utility library for measuring React component render times.
Stars: ✭ 93 (+8.14%)
Mutual labels:  performance, performance-metrics, test
Jmeter Maven Plugin
The JMeter Maven Plugin
Stars: ✭ 362 (+320.93%)
Mutual labels:  performance-analysis, performance-testing, jmeter
Sparklens
Qubole Sparklens tool for performance tuning Apache Spark
Stars: ✭ 345 (+301.16%)
Mutual labels:  performance, performance-analysis, performance-metrics
Performance
⏱ PHP performance tool analyser your script on time, memory usage and db query. Support Laravel and Composer for web, web console and command line interfaces.
Stars: ✭ 429 (+398.84%)
Mutual labels:  performance, performance-analysis, performance-testing
Performance Testing Framework
Framework allows to perform load testing with Apache Jmeter, view application/server metrics in real-time with Grafana, analyze errors cause with detailed traces for failed requests, compare different test runs in scripted dashboard and perform frontend performance testing with sitespeed.io+webpagetest
Stars: ✭ 275 (+219.77%)
Mutual labels:  performance, performance-testing, jmeter
Drill
Drill is a HTTP load testing application written in Rust inspired by Ansible syntax
Stars: ✭ 767 (+791.86%)
Mutual labels:  performance, performance-testing, jmeter
Browser Perf
Performance Metrics for Web Browsers
Stars: ✭ 930 (+981.4%)
Mutual labels:  performance, performance-metrics
Woocommerce Loadimpact
Scenarios for `loadimpact.com`, written against Liquid Web's WooCommerce sample data.
Stars: ✭ 17 (-80.23%)
Mutual labels:  performance, performance-testing

junitperf

README-ENGLISH

junitperf 是一款为 java 开发者设计的性能测试框架。

Maven Central Build Status Open Source Love

为什么使用?

  • 可以和 Junit5 完美契合。

  • 使用简单,便于项目开发过程中的测试实用。

  • 提供拓展,用户可进行自定义开发。

特性

  • 支持 I18N

  • 支持多种报告生成方式,支持自定义

  • Junt5 完美支持,便于 Java 开发者使用

变更记录

变更日志

v2.0.7 主要变更

  1. 升级 heaven 依赖

快速开始

项目依赖

  • jdk1.8 及其以上版本

  • Junit5 及其以上版本

maven 导入

<dependency>
    <groupId>com.github.houbb</groupId>
    <artifactId>junitperf</artifactId>
    <version>2.0.7</version>
</dependency>

入门案例

入门案例地址

  • 使用例子
public class HelloWorldTest {

    @JunitPerfConfig(duration = 1000)
    public void helloTest() throws InterruptedException {
        Thread.sleep(100);
        System.out.println("Hello Junit5");
    }

}

配置说明

测试注解指定

@JunitPerfConfig

指定测试时的属性配置。(必填项)

属性 说明 类型 默认值 备注
threads 执行时使用多少线程执行 int 1
warmUp 准备时间 long 0 单位:毫秒
duration 执行时间 long 60_000(1分钟) 单位:毫秒
latencyStatistics 统计实现 StatisticsCalculator DefaultStatisticsCalculator
reporter 报告实现 Reporter ConsoleReporter

使用如下:

public class JunitPerfConfigTest {

    /**
     * 2个线程运行。
     * 准备时间:1000ms
     * 运行时间: 2000ms
     * @throws InterruptedException if any
     */
    @JunitPerfConfig(threads = 2, warmUp = 1000, duration = 2000)
    public void junitPerfConfigTest() throws InterruptedException {
        System.out.println("junitPerfConfigTest");
        Thread.sleep(200);
    }

}

各种报告的实现

这里主要是对于性能测试统计的输出方式。 支持以下方式:

方式 案例
默认方式 DefaultReporterTest
命令行 ConsoleReporterTest
HTML HtmlReporterTest
组合方式 MultiReporterTest
自定义方式 DefineReporterTest

@JunitPerfRequire

指定测试时需要达到的要求。(选填项)

属性 说明 类型 默认值 备注
min 最佳的运行耗时 float -1 最快的运行耗时如果高于这个值,则视为失败。单位:毫秒
max 平均的运行耗时 float -1 最坏的运行耗时如果高于这个值,则视为失败。单位:毫秒
average 平均的运行耗时 float -1 平均的运行耗时如果高于这个值,则视为失败。单位:毫秒
timesPerSecond 每秒的最小执行次数 int 0 如果低于这个最小执行次数,则视为失败。
percentiles 对于执行耗时的限定 String[] {} percentiles={"20:220", "30:250"}。20% 的数据执行耗时不得超过 220ms;30% 的数据执行耗时不得超过 250ms;

使用如下:

public class JunitPerfRequireTest {
    /**
     * 配置:2个线程运行。准备时间:1000ms。运行时间: 2000ms。
     * 要求:最快不可低于 210ms, 最慢不得低于 250ms, 平均不得低于 225ms, 每秒运行次数不得低于 4 次。
     * 20% 的数据不低于 220ms, 50% 的数据不得低于 230ms;
     *
     * @throws InterruptedException if any
     */
    @JunitPerfConfig(threads = 2, warmUp = 1000, duration = 2000)
    @JunitPerfRequire(min = 210, max = 250, average = 225, timesPerSecond = 4, percentiles = {"20:220", "50:230"})
    public void junitPerfConfigTest() throws InterruptedException {
        System.out.println("junitPerfConfigTest");
        Thread.sleep(200);
    }

}

报告方式

命令行方式

大致如下:

[INFO] [2020-06-16 20:05:53.618] [c.g.h.j.e.HelloWorldTest.helloTest] - Started at:  2020-06-16 20:05:52.512
[INFO] [2020-06-16 20:05:53.619] [c.g.h.j.e.HelloWorldTest.helloTest] - Invocations:  9
[INFO] [2020-06-16 20:05:53.620] [c.g.h.j.e.HelloWorldTest.helloTest] - Success:  9
[INFO] [2020-06-16 20:05:53.620] [c.g.h.j.e.HelloWorldTest.helloTest] - Errors:  0
[INFO] [2020-06-16 20:05:53.621] [c.g.h.j.e.HelloWorldTest.helloTest] - Thread Count:  1
[INFO] [2020-06-16 20:05:53.623] [c.g.h.j.e.HelloWorldTest.helloTest] - Warm up:  0ms
[INFO] [2020-06-16 20:05:53.623] [c.g.h.j.e.HelloWorldTest.helloTest] - Execution time:  1000ms
[INFO] [2020-06-16 20:05:53.624] [c.g.h.j.e.HelloWorldTest.helloTest] - Throughput:  9/s (Required: -1/s) - PASSED
[INFO] [2020-06-16 20:05:53.625] [c.g.h.j.e.HelloWorldTest.helloTest] - Memory cost:  16byte
[INFO] [2020-06-16 20:05:53.635] [c.g.h.j.e.HelloWorldTest.helloTest] - Min latency:  100.191414ms (Required: -1.0ms) - PASSED
[INFO] [2020-06-16 20:05:53.635] [c.g.h.j.e.HelloWorldTest.helloTest] - Max latency:  105.2382ms (Required: -1.0ms) - PASSED
[INFO] [2020-06-16 20:05:53.636] [c.g.h.j.e.HelloWorldTest.helloTest] - Avg latency:  101.43268ms (Required: -1.0ms) - PASSED

HTML 方式

页面如下:

后期会进行样式调整。

junitperf-report-html.png

指定方法执行顺序

说明

方法的执行顺序会影响到最终的报告显示顺序。

如果你想严格指定同一个类方法的执行顺序,推荐使用 Test Execution Order 的方式。

@TestMethodOrder 需要 junit5 在 5.4 及其以后版本

示例代码

参考 OrderedHtmlTest

对于 junit4 的支持

引入 jar

<dependency>
    <groupId>com.github.houbb</groupId>
    <artifactId>junitperf</artifactId>
    <version>1.0.3</version>
</dependency>

相关文档

junit4 相关使用

友情提示

I18N 功能中的中文 properties 文件直接使用 UTF-8 格式。

如果你下载本项目进行测试,出现中文乱码。

IDEA

idea 用户请勾选上图中的选项

【Setting】=》【File Encoding】勾选上 ascii 转换

idea-proerties-ascii.png

关联开源框架

data-factory 自动生成测试数据

gen-test-plugin 自动生成测试案例的 maven 插件

后期 Road-MAP

  • [X] 内存使用统计

  • [ ] 支持线程的 sync 同步执行

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].