Free-style benchmarking tool written in java

A free-style benchmarking tool that can test anything callable by Java. And it produces apache-ab-like results

Лицензия

Лицензия

Группа

Группа

com.github.chenjianjx
Идентификатор

Идентификатор

freebencher
Последняя версия

Последняя версия

2.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Free-style benchmarking tool written in java
A free-style benchmarking tool that can test anything callable by Java. And it produces apache-ab-like results
Ссылка на сайт

Ссылка на сайт

https://github.com/chenjianjx/freebencher
Система контроля версий

Система контроля версий

https://github.com/chenjianjx/freebencher

Скачать freebencher

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.chenjianjx/freebencher/ -->
<dependency>
    <groupId>com.github.chenjianjx</groupId>
    <artifactId>freebencher</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.chenjianjx/freebencher/
implementation 'com.github.chenjianjx:freebencher:2.0.0'
// https://jarcasting.com/artifacts/com.github.chenjianjx/freebencher/
implementation ("com.github.chenjianjx:freebencher:2.0.0")
'com.github.chenjianjx:freebencher:jar:2.0.0'
<dependency org="com.github.chenjianjx" name="freebencher" rev="2.0.0">
  <artifact name="freebencher" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.chenjianjx', module='freebencher', version='2.0.0')
)
libraryDependencies += "com.github.chenjianjx" % "freebencher" % "2.0.0"
[com.github.chenjianjx/freebencher "2.0.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
commons-lang : commons-lang jar 2.6

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.9

Модули Проекта

Данный проект не имеет модулей.

freebencher

A Quick Example

pom.xml

 


	<dependencies>
		<dependency>
			<groupId>com.github.chenjianjx</groupId>
			<artifactId>freebencher</artifactId>
			<version>2.0.0</version>
		</dependency>
		...
	</dependencies>	

Basically, you'll just need to write a callback method.

	@Test
	public void testLogin() {
		
		final List<User> userList = new ArrayList<User>();
		...//preparing userList to be used as test data.

		FbJobResult result = Freebencher.benchmark(new FbTarget() { //the behavior
			@Override
			public boolean invoke() {
				User user = userList.get(RandomUtils
						.nextInt(userList.size()));
				int statusCode = remoteServiceToTest.doLogin(user.getUsername(), user.getClearPassword());
				return statusCode == 200;
			}
		}, 5, // concurrency,
				50 // number of tests to run
				);

		System.out.println(result.report());
	}

You will get ApacheBench-like output:

Test started.
Awaiting termination...
Test completed.
Concurrency:             5
Time taken for tests:    119ms
Successful tests:        50
Failed tests:            0
Tests per second:        420.16806722689074
Mean time per test:      11.38ms
Percentage of the test finished within a certain time (ms)
50%:                     11
60%:                     12
70%:                     12
80%:                     13
90%:                     14
95%:                     14
98%:                     14
99%:                     16
100%:                    16

Why freebencher

  1. Simpler compared to GUI tools such as JMeter.
  2. More Parameterizable compared to Apache ab, which can take only one fixed URL.
  3. Most important, it is Embeddable. You integrate the testing framework into your own java project, so you can freely use your own business classes. On the contrary, other tools such as JMeter requires you to package your code into their library. The packaging and integration is very troublesome and cannot be automated. This is why freebencher was written.
  4. Freedom to developers.
  • You can test any behavior that can be written in Java, not just Http Servers.
  • You can prepare your test data in any way in Java, as long as the callback method can reference it. Aren't you sick of generating data files and "browse" it for GUI tools?
  • You can make assertions of the correctness of the testing results anyway you want using Java code.

Версии библиотеки

Версия
2.0.0