Package org.apache.jmeter.extractor
Class RegexExtractor
java.lang.Object
org.apache.jmeter.testelement.AbstractTestElement
org.apache.jmeter.testelement.AbstractScopedTestElement
org.apache.jmeter.extractor.RegexExtractor
- All Implemented Interfaces:
Serializable,Cloneable,Searchable,PostProcessor,org.apache.jmeter.testelement.TestElement
public class RegexExtractor
extends AbstractScopedTestElement
implements PostProcessor, Serializable
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.jmeter.testelement.TestElement
org.apache.jmeter.testelement.TestElement.Companion -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface org.apache.jmeter.testelement.TestElement
COMMENTS, Companion, ENABLED, GUI_CLASS, NAME, TEST_CLASS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the default value for the variable, which should be used, if no matches are foundintorg.apache.jmeter.testelement.schema.PropertiesAccessor<? extends RegexExtractor,? extends org.apache.jmeter.extractor.RegexExtractorSchema> getProps()Get the prefix name of the variable to be used to store the regex matchesgetRegex()Get the regex which is to be usedorg.apache.jmeter.extractor.RegexExtractorSchemabooleanDo we set default value to "" value when if it's emptyvoidprocess()Parses the response data using regular expressions and saving the results into variables for use later in the test.voidsetDefaultEmptyValue(boolean defaultEmptyValue) Set default value to "" value when if it's emptyvoidsetDefaultValue(String defaultValue) Sets the value of the variable if no matches are foundvoidsetMatchNumber(int matchNumber) Set which Match to use.voidsetMatchNumber(String matchNumber) voidsetRefName(String refName) Set the prefix name of the variable to be used to store the regex matchesvoidSet the regex to be usedvoidsetTemplate(String template) voidsetUseField(String actionCommand) booleanuseBody()booleanbooleanuseCode()booleanbooleanbooleanbooleanbooleanuseUrl()Methods inherited from class org.apache.jmeter.testelement.AbstractScopedTestElement
fetchScope, getSampleList, getScopeName, getVariableName, isScopeAll, isScopeChildren, isScopeParent, isScopeVariable, isScopeVariable, setScopeAll, setScopeChildren, setScopeParent, setScopeVariableMethods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addPropertiesValues, addProperty, addProperty, addTestElement, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getPropertyOrNull, 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, traversePropertyMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jmeter.testelement.TestElement
get, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getPropertyOrNull, getString, removed, removeProperty, set, set, set, set, set, set, set, set, set
-
Field Details
-
USE_HDRS
- See Also:
-
USE_REQUEST_HDRS
- See Also:
-
USE_BODY
- See Also:
-
USE_BODY_UNESCAPED
- See Also:
-
USE_BODY_AS_DOCUMENT
- See Also:
-
USE_URL
- See Also:
-
USE_CODE
- See Also:
-
USE_MESSAGE
- See Also:
-
-
Constructor Details
-
RegexExtractor
public RegexExtractor()
-
-
Method Details
-
getSchema
public org.apache.jmeter.extractor.RegexExtractorSchema getSchema()- Specified by:
getSchemain interfaceorg.apache.jmeter.testelement.TestElement- Overrides:
getSchemain classAbstractScopedTestElement
-
getProps
public org.apache.jmeter.testelement.schema.PropertiesAccessor<? extends RegexExtractor,? extends org.apache.jmeter.extractor.RegexExtractorSchema> getProps()- Specified by:
getPropsin interfaceorg.apache.jmeter.testelement.TestElement- Overrides:
getPropsin classAbstractScopedTestElement
-
process
public void process()Parses the response data using regular expressions and saving the results into variables for use later in the test.- Specified by:
processin interfacePostProcessor- See Also:
-
setRegex
Set the regex to be used- Parameters:
regex- The string representation of the regex
-
getRegex
Get the regex which is to be used- Returns:
- string representing the regex
-
setRefName
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
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
public void setMatchNumber(int matchNumber) Set which Match to use. This can be any positive number, indicating the exact match to use, or0, which is interpreted as meaning random.- Parameters:
matchNumber- The number of the match to be used, or0if a random match should be used.
-
setMatchNumber
-
getMatchNumber
public int getMatchNumber() -
getMatchNumberAsString
-
setDefaultValue
Sets the value of the variable if no matches are found- Parameters:
defaultValue- The default value for the variable
-
setDefaultEmptyValue
public void setDefaultEmptyValue(boolean defaultEmptyValue) Set default value to "" value when if it's empty- Parameters:
defaultEmptyValue- The default value for the variable
-
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
public 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
-
getTemplate
-
useHeaders
public boolean useHeaders() -
useRequestHeaders
public boolean useRequestHeaders() -
useBody
public boolean useBody() -
useUnescapedBody
public boolean useUnescapedBody() -
useBodyAsDocument
public boolean useBodyAsDocument() -
useUrl
public boolean useUrl() -
useCode
public boolean useCode() -
useMessage
public boolean useMessage() -
setUseField
-