项目作者: anasoid

项目描述 :
Jmeter as code is the way to write jmeter test as code.
高级语言: Java
项目地址: git://github.com/anasoid/jmeter-as-code.git
创建时间: 2020-09-15T12:26:40Z
项目社区:https://github.com/anasoid/jmeter-as-code

开源协议:Apache License 2.0

下载


Write Jmeter tests as code.

An API that give access to full Jmeter feature as code, All designed object in GUI can be written as code.

Build & Test
Audit
Coverage
Lines of Code
Security Rating
Reliability Rating
Maintainability Rating

Maven Central
javadoc

Where to start

If you are new with Jmeter as code, try examples project and see documentation website.

A basic script example:
  1. TestPlanWrapper testPlan = TestPlanWrapper.builder()
  2. .addThread(ThreadGroupWrapper.builder()
  3. .addSampler(
  4. HTTPSamplerProxyWrapper.builder()
  5. .withName("Home")
  6. .withDomain("https://github.com")
  7. .withProtocol("https")
  8. .withPath("/anasoid")
  9. .build())
  10. .build())
  11. .build();
  12. ApplicationTest applicationTest = new ApplicationTest(testPlanWrapper);
  13. applicationTest.run();
  14. //OR
  15. applicationTest.toJmx(new File("mytest.jmx"));
A basic script example using template:
  1. TestPlanWrapper testPlan = TestPlanWrapper.builder()
  2. .addThread(ThreadGroupWrapper.builder()
  3. .addSampler(new HomePage())
  4. .build())
  5. .build();
  6. ApplicationTest applicationTest = new ApplicationTest(testPlanWrapper);
  7. applicationTest.run();
  8. //OR
  9. applicationTest.toJmx(new File("mytest.jmx"));
  10. class HomePage extends
  11. AbstractJmcTemplate<HTTPSamplerProxyWrapper, HTTPSamplerProxyWrapperBuilder<?, ?>> {
  12. @Override
  13. protected void prepareBuilder(HTTPSamplerProxyWrapperBuilder<?, ?> builder) {
  14. super.prepareBuilder(builder);
  15. builder.withName("Home")
  16. .withDomain("https://github.com")
  17. .withProtocol("https")
  18. .withPath("/anasoid");
  19. }
  20. @Override
  21. protected JmcWrapperBuilder<?> init() {
  22. return HTTPSamplerProxyWrapper.builder();
  23. }
  24. }