org.apache.jmeter.functions

Interface Function

Known Implementing Classes:
AbstractFunction, BeanShell, CharFunction, CompoundVariable, CSVRead, EscapeHtml, EvalFunction, EvalVarFunction, IntSum, IterationCounter, JavaScript, JexlFunction, LogFunction, LogFunction2, LongSum, MachineName, Property, Property2, Random, RegexFunction, SetProperty, SplitFunction, StringFromFile, ThreadNumber, TimeFunction, UnEscape, UnEscapeHtml, Variable, XPath

public interface Function

Methods that a function must implement

Method Summary

String
execute(SampleResult previousResult, Sampler currentSampler)
Given the previous SampleResult and the current Sampler, return a string to use as a replacement value for the function call.
List
getArgumentDesc()
Return a list of strings briefly describing each parameter your function takes.
String
getReferenceKey()
Return the name of your function.
void
setParameters(Collection parameters)
A collection of the parameters used to configure your function.

Method Details

execute

public String execute(SampleResult previousResult,
                      Sampler currentSampler)
            throws InvalidVariableException
Given the previous SampleResult and the current Sampler, return a string to use as a replacement value for the function call. Assume "setParameter" was previously called. This method must be threadsafe - multiple threads will be using the same object.

getArgumentDesc

public List getArgumentDesc()
Return a list of strings briefly describing each parameter your function takes. Please use JMeterUtils.getResString(resource_name) to grab a resource string. Otherwise, your help text will be difficult to internationalize. This list is not optional. If you don't wish to write help, you must at least return a List containing the correct number of blank strings, one for each argument.

getReferenceKey

public String getReferenceKey()
Return the name of your function. Convention is to prepend "__" to the name (ie "__regexFunction")

setParameters

public void setParameters(Collection parameters)
            throws InvalidVariableException
A collection of the parameters used to configure your function. Each parameter is a CompoundFunction and can be resolved by calling the execute() method of the CompoundFunction (which should be done at execution.)
Parameters:
parameters -

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.