public class JUnitSampler extends AbstractSampler implements ThreadListener
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS
Constructor and Description |
---|
JUnitSampler() |
Modifier and Type | Method and Description |
---|---|
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() |
boolean |
getCreateOneInstancePerSample() |
boolean |
getDoNotSetUpTearDown()
if the sample shouldn't call setup/teardown, the
method returns true.
|
String |
getError() |
String |
getErrorCode() |
String |
getFailure() |
String |
getFailureCode() |
String |
getFilterString() |
boolean |
getJunit4()
Check if JUnit4 (annotations) are to be used instead of
the JUnit3 style (TestClass and specific method names)
|
String |
getMethod() |
String |
getSuccess() |
String |
getSuccessCode() |
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 comma 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 success code.
|
void |
threadFinished()
Called for each thread after all samples have been processed.
|
void |
threadStarted()
Set up all variables that don't change between samples.
|
applies
addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
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, removed, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse
public void setClassname(String classname)
classname
- the new Classname valuepublic String getClassname()
public void setConstructorString(String constr)
constr
- the string passed to the constructorpublic String getConstructorString()
public String getMethod()
public void setMethod(String methodName)
methodName
- name of the method to testpublic String getSuccess()
public void setSuccess(String success)
success
- message to be used for successpublic String getSuccessCode()
public void setSuccessCode(String code)
code
- unique success codepublic String getFailure()
public void setFailure(String fail)
fail
- the failure messagepublic String getFailureCode()
public void setFailureCode(String code)
code
- unique code to denote the type of failurepublic String getError()
public void setError(String error)
error
- the description of the errorpublic String getErrorCode()
public void setErrorCode(String code)
code
- unique error codepublic String getFilterString()
public void setFilterString(String text)
text
- comma separated filterpublic boolean getDoNotSetUpTearDown()
public void setDoNotSetUpTearDown(boolean setup)
setup
- flag whether the setup/teardown methods should not be calledpublic boolean getAppendError()
public void setAppendError(boolean error)
error
- the setting to applypublic boolean getAppendException()
false
.
Users have to explicitly set it to true
to see the exceptions
in the result tree.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)
public void threadFinished()
ThreadListener
threadFinished
in interface ThreadListener
public void threadStarted()
threadStarted
in interface ThreadListener
public void setCreateOneInstancePerSample(boolean createOneInstancePerSample)
createOneInstancePerSample
- flag whether a new instance for each call should be createdpublic boolean getCreateOneInstancePerSample()
Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.