Package dev.galasa.jmeter
Interface IJMeterSession
public interface IJMeterSession
Interface for creation, management, deletion of JMeter sessions
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyProperties
(InputStream propStream) This method gets called before start of a session providing necessary properties to the JMeter sessionvoid
applyProperties
(InputStream propStream, Map<String, Object> properties) This method gets called before start of a session providing necessary properties to the JMeter session The properties hashmap adds upon the propStream input with personalised propertiesReturns the consoleOutput in String formatlong
Returns the exit code of the the shutdown of the JMeterProcessReturning the jmxFile in UTF-8 encoding in String format The working directory is found through the session instancegetListenerFile
(String fileName) Return the output file of your jmx execution in String format The working directory is found through the session instanceReturning the logFile in UTF-8 encoding in String format The working directory is found through the session instanceint
void
setChangedParametersJmxFile
(InputStream jmxStream, Map<String, Object> parameters) Allows the tester to provide a jmxFile to the running session This method is provided to run dynamic JMX-files that are dynamic with the current session it is running in JMX-files have to be prepared for this by replacing ALL the $P__VARIABLE notations with $VARIABLE notations Then by adding neccesary parameters inside a HashMap with it, it is possible to change the target of a test dynamically inside the test Example:void
setDefaultGeneratedJmxFile
(InputStream jmxStream) Allows the tester to provide a jmxFile to the running session This method is provided to run static JMX-files that are NOT dynamic with the current session it is running invoid
Start up a jmeter thread to run through the lifetime of the tests with a default timeout of 60 seconds All results are stored in the RASvoid
startJmeter
(int timeout) Start up a jmeter thread to run through the lifetime of the tests with a specified timeout All results are stored in the RASboolean
void
stopTest()
Giving jmeter instance a shutdown signal to finish and clean up all running tests
-
Method Details
-
applyProperties
This method gets called before start of a session providing necessary properties to the JMeter session- Parameters:
propStream
- An inputstream of the properties file- Throws:
JMeterManagerException
-
applyProperties
void applyProperties(InputStream propStream, Map<String, Object> properties) throws JMeterManagerExceptionThis method gets called before start of a session providing necessary properties to the JMeter session The properties hashmap adds upon the propStream input with personalised properties- Parameters:
propStream
- An inputstream of the properties fileproperties
- A hashmap of dynamic properties- Throws:
JMeterManagerException
-
startJmeter
Start up a jmeter thread to run through the lifetime of the tests with a default timeout of 60 seconds All results are stored in the RAS- Throws:
JMeterManagerException
-
startJmeter
Start up a jmeter thread to run through the lifetime of the tests with a specified timeout All results are stored in the RAS- Throws:
JMeterManagerException
-
setDefaultGeneratedJmxFile
Allows the tester to provide a jmxFile to the running session This method is provided to run static JMX-files that are NOT dynamic with the current session it is running in- Parameters:
jmxStream
-- Throws:
JMeterManagerException
-
setChangedParametersJmxFile
void setChangedParametersJmxFile(InputStream jmxStream, Map<String, Object> parameters) throws JMeterManagerExceptionAllows the tester to provide a jmxFile to the running session This method is provided to run dynamic JMX-files that are dynamic with the current session it is running in JMX-files have to be prepared for this by replacing ALL the $P__VARIABLE notations with $VARIABLE notations Then by adding neccesary parameters inside a HashMap with it, it is possible to change the target of a test dynamically inside the test Example:HashMap<String,Object> map = new HashMap<String,Object>(); map.put("HOST", "galasa.dev"); session.setChangedParametersJmxFile(jmxStream, map);
- Parameters:
jmxStream
-parameters
-- Throws:
JMeterManagerException
-
getJmxFile
Returning the jmxFile in UTF-8 encoding in String format The working directory is found through the session instance- Throws:
JMeterManagerException
-
getLogFile
Returning the logFile in UTF-8 encoding in String format The working directory is found through the session instance- Throws:
JMeterManagerException
-
getConsoleOutput
Returns the consoleOutput in String format- Returns:
- String of console
- Throws:
JMeterManagerException
-
getListenerFile
Return the output file of your jmx execution in String format The working directory is found through the session instance- Parameters:
fileName
- the ListenerFile- Throws:
JMeterManagerException
-
statusTest
- Returns:
- the logFile gets returned as a string like "cat" would in a linux container
- Throws:
JMeterManagerException
-
stopTest
Giving jmeter instance a shutdown signal to finish and clean up all running tests- Throws:
JMeterManagerException
-
getExitCode
Returns the exit code of the the shutdown of the JMeterProcess- Returns:
- exitcode as a long
- Throws:
JMeterManagerException
-
getSessionID
int getSessionID()
-