apache / apache/jmeter

Provide API for running JMeter

Open
#2,406 5 comments 0 reactions 0 assignees View on GitHub
enhancement os: All P1
Dominant language
Java
Stars
9.5k
Forks
2.3k
Avg merge
1d 22h
Merged PRs (30d)
5

Description

**BTO Team @ Sabre-Holdings** ([Bug 50034](https://bz.apache.org/bugzilla//show_bug.cgi?id=50034&redirect=false)):
To enable effective test automation with Jmeter we would like to use Jmeter in non-gui mode calling it directly in Java app. This is very similar scenario as in case maven-jmeter-plugin...

Currently we have to:
1. create new JMeter()
2. invoke start with command line args.
3. parse JMeter log to find the results.
4. change security manager to capture System.exit calls
5. wait for all of the threads that it spawned to exit

We would like to:
1. create new JMeterNonGUI()
2. invoke runTest with all arguments passed as appropriate objects (no need to wrap and parse them)
3. wait for runTest to end (it should execute all tests)
4. read test results returned by runTest

Example:

JMeterNonGUI jmeter = new JMeterNonGUI();
TestResults results = jmeter.runTests(jmxTestFile);

I propose to:
- extract from JMeter class JMeterGUI class responsible for starting GUI version of JMeter
- extract from JMeter class JMeterNonGUI class responsible for starting non-GUI version of JMeter
- refactor the code so that JMeter class will be responsible only for parsing command line arguments and delegating JMeter start to appropriate class JMeterGUI or JMeterNonGUI
- create public JMeterNonGUI.runTests method that will block execution until test end and will gather test results to some TestResults list (the hardest part?)
- replace all System.exit calls with call to some SystemExitHandlerInterface that in case of non-GUI method can be implemented without using System.exit

Votes in Bugzilla: 6
OS: All

Duplicates:
* https://github.com/apache/jmeter/issues/2447
* https://github.com/apache/jmeter/issues/5448

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.