Class RegexExtractor
-
- All Implemented Interfaces:
-
java.io.Serializable,java.lang.Cloneable,org.apache.jmeter.gui.Searchable,org.apache.jmeter.processor.PostProcessor,org.apache.jmeter.testelement.TestElement
public class RegexExtractor extends AbstractScopedTestElement implements PostProcessor, Serializable
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringUSE_HDRSpublic final static StringUSE_REQUEST_HDRSpublic final static StringUSE_BODYpublic final static StringUSE_BODY_UNESCAPEDpublic final static StringUSE_BODY_AS_DOCUMENTpublic final static StringUSE_URLpublic final static StringUSE_CODEpublic final static StringUSE_MESSAGEpublic transient JMeterContextthreadContextpublic transient StringthreadNamepublic final static TestElement.CompanionCompanionpublic final static StringNAMEpublic final static StringGUI_CLASSpublic final static StringENABLEDpublic final static StringTEST_CLASSpublic final static StringCOMMENTS
-
Constructor Summary
Constructors Constructor Description RegexExtractor()
-
Method Summary
Modifier and Type Method Description RegexExtractorSchemagetSchema()PropertiesAccessor<out RegexExtractor, out RegexExtractorSchema>getProps()voidprocess()Parses the response data using regular expressions and saving the results into variables for use later in the test. voidsetRegex(String regex)Set the regex to be used StringgetRegex()Get the regex which is to be used voidsetRefName(String refName)Set the prefix name of the variable to be used to store the regex matches StringgetRefName()Get the prefix name of the variable to be used to store the regex matches voidsetMatchNumber(int matchNumber)Set which Match to use. voidsetMatchNumber(String matchNumber)intgetMatchNumber()StringgetMatchNumberAsString()voidsetDefaultValue(String defaultValue)Sets the value of the variable if no matches are found voidsetDefaultEmptyValue(boolean defaultEmptyValue)Set default value to "" value when if it's empty StringgetDefaultValue()Get the default value for the variable, which should be used, if no matches are found booleanisEmptyDefaultValue()Do we set default value to "" value when if it's empty voidsetTemplate(String template)StringgetTemplate()booleanuseHeaders()booleanuseRequestHeaders()booleanuseBody()booleanuseUnescapedBody()booleanuseBodyAsDocument()booleanuseUrl()booleanuseCode()booleanuseMessage()voidsetUseField(String actionCommand)-
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addTestElement, canRemove, clear, clearTestElementChildren, clone, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getPropertyOrNull, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse -
Methods inherited from class org.apache.jmeter.testelement.AbstractScopedTestElement
fetchScope, getVariableName, isScopeAll, isScopeChildren, isScopeParent, isScopeVariable, setScopeAll, setScopeChildren, setScopeParent, setScopeVariable -
Methods inherited from class org.apache.jmeter.testelement.TestElement
get, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getProps, getSchema, getString, removed, set -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getSchema
RegexExtractorSchema getSchema()
-
getProps
PropertiesAccessor<out RegexExtractor, out RegexExtractorSchema> getProps()
-
process
void process()
Parses the response data using regular expressions and saving the results into variables for use later in the test.
-
setRegex
void setRegex(String regex)
Set the regex to be used
- Parameters:
regex- The string representation of the regex
-
setRefName
void setRefName(String refName)
Set the prefix name of the variable to be used to store the regex matches
- Parameters:
refName- prefix of the variables to be used
-
getRefName
String getRefName()
Get the prefix name of the variable to be used to store the regex matches
- Returns:
The prefix of the variables to be used
-
setMatchNumber
void setMatchNumber(int matchNumber)
Set which Match to use. This can be any positive number, indicating the exact match to use, or
0, which is interpreted as meaning random.- Parameters:
matchNumber- The number of the match to be used, or0if a random match should be used.
-
setMatchNumber
void setMatchNumber(String matchNumber)
-
getMatchNumber
int getMatchNumber()
-
getMatchNumberAsString
String getMatchNumberAsString()
-
setDefaultValue
void setDefaultValue(String defaultValue)
Sets the value of the variable if no matches are found
- Parameters:
defaultValue- The default value for the variable
-
setDefaultEmptyValue
void setDefaultEmptyValue(boolean defaultEmptyValue)
Set default value to "" value when if it's empty
- Parameters:
defaultEmptyValue- The default value for the variable
-
getDefaultValue
String getDefaultValue()
Get the default value for the variable, which should be used, if no matches are found
- Returns:
The default value for the variable
-
isEmptyDefaultValue
boolean isEmptyDefaultValue()
Do we set default value to "" value when if it's empty
- Returns:
true if we should set default value to "" if variable cannot be extracted
-
setTemplate
void setTemplate(String template)
-
getTemplate
String getTemplate()
-
useHeaders
boolean useHeaders()
-
useRequestHeaders
boolean useRequestHeaders()
-
useBody
boolean useBody()
-
useUnescapedBody
boolean useUnescapedBody()
-
useBodyAsDocument
boolean useBodyAsDocument()
-
useUrl
boolean useUrl()
-
useCode
boolean useCode()
-
useMessage
boolean useMessage()
-
setUseField
void setUseField(String actionCommand)
-
-
-
-