|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jmeter.testelement.AbstractTestElement org.apache.jmeter.samplers.AbstractSampler org.apache.jmeter.protocol.java.sampler.JUnitSampler
public class JUnitSampler
This is a basic implementation that runs a single test method of a JUnit test case. The current implementation will use the string constructor first. If the test class does not declare a string constructor, the sampler will try empty constructor.
Field Summary |
---|
Fields inherited from interface org.apache.jmeter.testelement.TestElement |
---|
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS |
Constructor Summary | |
---|---|
JUnitSampler()
|
Method Summary | |
---|---|
boolean |
getAppendError()
If append error is not set, by default it is set to false, which means users have to explicitly set the sampler to append the assert errors. |
boolean |
getAppendException()
If append exception is not set, by default it is set to false. |
String |
getClassname()
Gets the Classname attribute of the JavaConfig object |
String |
getConstructorString()
get the string passed to the string constructor |
boolean |
getCreateOneInstancePerSample()
|
boolean |
getDoNotSetUpTearDown()
if the sample shouldn't call setup/teardown, the method returns true. |
String |
getError()
return the descriptive error for the test |
String |
getErrorCode()
return the error code for the test method. it should be an unique error code. |
String |
getFailure()
get the failure message |
String |
getFailureCode()
The failure code is used by other components |
String |
getFilterString()
return the comma separated string for the filter |
boolean |
getJunit4()
Check if JUnit4 (annotations) are to be used instead of the JUnit3 style (TestClass and specific method names) |
String |
getMethod()
Return the name of the method to test |
String |
getSuccess()
get the success message |
String |
getSuccessCode()
get the success code defined by the user |
SampleResult |
sample(Entry entry)
Obtains statistics about the given Entry, and packages the information into a SampleResult. |
void |
setAppendError(boolean error)
Set whether to append errors or not. |
void |
setAppendException(boolean exc)
Set whether to append exceptions or not. |
void |
setClassname(String classname)
Sets the Classname attribute of the JavaConfig object |
void |
setConstructorString(String constr)
Set the string label used to create an instance of the test with the string constructor. |
void |
setCreateOneInstancePerSample(boolean createOneInstancePerSample)
|
void |
setDoNotSetUpTearDown(boolean setup)
set the setup/teardown option |
void |
setError(String error)
provide a descriptive error for the test method. |
void |
setErrorCode(String code)
provide an unique error code for when the test does not pass the assert test. |
void |
setFailure(String fail)
set the failure message |
void |
setFailureCode(String code)
Provide some unique code to denote a type of failure |
void |
setFilterString(String text)
set the filter string in comman separated format |
void |
setJunit4(boolean junit4)
Set whether to use JUnit4 style or not. |
void |
setMethod(String methodName)
Method should add the JUnit testXXX method to the list at the end, since the sequence matters. |
void |
setSuccess(String success)
set the success message |
void |
setSuccessCode(String code)
set the succes code. the success code should be unique. |
void |
threadFinished()
Called for each thread after all samples have been processed. |
void |
threadStarted()
Set up all variables that don't change between samples. |
Methods inherited from class org.apache.jmeter.samplers.AbstractSampler |
---|
applies |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.jmeter.testelement.TestElement |
---|
addTestElement, canRemove, clear, clearTestElementChildren, clone, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse |
Constructor Detail |
---|
public JUnitSampler()
Method Detail |
---|
public void setClassname(String classname)
classname
- the new Classname valuepublic String getClassname()
public void setConstructorString(String constr)
constr
- public String getConstructorString()
public String getMethod()
public void setMethod(String methodName)
methodName
- public String getSuccess()
public void setSuccess(String success)
success
- public String getSuccessCode()
public void setSuccessCode(String code)
code
- public String getFailure()
public void setFailure(String fail)
fail
- public String getFailureCode()
public void setFailureCode(String code)
code
- public String getError()
public void setError(String error)
error
- public String getErrorCode()
public void setErrorCode(String code)
code
- public String getFilterString()
public void setFilterString(String text)
text
- public boolean getDoNotSetUpTearDown()
public void setDoNotSetUpTearDown(boolean setup)
setup
- public boolean getAppendError()
public void setAppendError(boolean error)
error
- the setting to applypublic boolean getAppendException()
public void setAppendException(boolean exc)
exc
- the setting to apply.public boolean getJunit4()
public void setJunit4(boolean junit4)
junit4
- true if JUnit4 style is to be used.public SampleResult sample(Entry entry)
sample
in interface Sampler
public void threadFinished()
ThreadListener
threadFinished
in interface ThreadListener
JMeterThread.threadFinished(LoopIterationListener)
public void threadStarted()
threadStarted
in interface ThreadListener
JMeterThread.threadStarted()
public void setCreateOneInstancePerSample(boolean createOneInstancePerSample)
createOneInstancePerSample
- public boolean getCreateOneInstancePerSample()
|
Apache JMeter | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |