Easy to use java based, stress test suite 中文说明
Features
- Small and flexible, without any third party dependence
- Scalability is good, you can customize the data source
- The pressure measurement code is easy to manage in one project, and the pressure measurement method is specified according to the command during pressure measurement.
- After the long-term use of the project, the accuracy of the pressure measurement is high
- Packaged as an executable jar for easy use anywhere
Maven dependency
<dependency>
<groupId>com.github.xincao9</groupId>
<artifactId>ptk-core</artifactId>
<version>1.0</version>
</dependency>
com.github.xincao9.ptk.core.Source
Data source: A collection of data for testing. By default, Source implements FileSource and SequenceSource
If custom
public class D {
private final int id;
public D(int id) {
this.id = id;
}
public int getId() {
return this.id;
}
}
public class SourceD implements Source {
@Override
public int read() {
for (int i = 1; i < 5000; i++) {
Worker.submit(new D(i)); // Write to the pressure data pool
}
return 5000;
}
}
com.github.xincao9.ptk.core.Method
Test method: code block for pressure measurement
@Test(name = "MethodD")
public class MethodD extends Method {
@Override
public void exec(Object params) {
D d = (D) params;
Logger.info(d.getId());
}
}
Startup method
PTKCore.bootstrap(new SourceD(), args);
Command line execution
java -jar ptk-sample/target/ptk-sample-1.0.jar
1.cmd -[c, t, m] value
2.com.github.xincao9.ptk.core.Source interface must be implemented, implemented as a read data source
The 3.com.github.xincao9.ptk.core.Method interface must be implemented and needs to be identified by the @Test identifier as the code block to be tested.
4.com.github.xincao9.ptk.core.Result interface does not have to be implemented, it can output test results to its own system
5.-c Concurrency limit 0 < concurrent <= 1024 Default CPU core number
6.-t request delay limit cd > 0 default 0ms; it is recommended to block the call to set a small point, calculate the dense call to set a large point, less than 0 for never delay
7.-m test method class
java -jar ptk-sample/target/ptk-sample-1.0.jar -m MethodD -c 2 -t -1