org.apache.jmeter.functions

Class StringFromFile

Implemented Interfaces:
Function, TestListener

public class StringFromFile
extends AbstractFunction
implements TestListener

StringFromFile Function to read a String from a text file. Parameters: - file name - variable name (optional - defaults to StringFromFile_) Returns: - the next line from the file - or **ERR** if an error occurs - value is also saved in the variable for later re-use. Ensure that different variable names are used for each call to the function Notes: - JMeter instantiates a copy of each function for every reference in a Sampler or elsewhere; each instance will open its own copy of the the file - the file name is resolved at file (re-)open time - the output variable name is resolved every time the function is invoked

Constructor Summary

StringFromFile()

Method Summary

String
execute(SampleResult previousResult, Sampler currentSampler)
List
getArgumentDesc()
String
getReferenceKey()
void
setParameters(Collection parameters)
void
testEnded()
void
testEnded(String host)
void
testIterationStart(LoopIterationEvent event)
void
testStarted()
void
testStarted(String host)

Methods inherited from class org.apache.jmeter.functions.AbstractFunction

checkMinParameterCount, checkParameterCount, checkParameterCount, execute, execute, getReferenceKey, getVariables, setParameters

Constructor Details

StringFromFile

public StringFromFile()

Method Details

execute

public String execute(SampleResult previousResult,
                      Sampler currentSampler)
            throws InvalidVariableException
Specified by:
execute in interface Function
Overrides:
execute in interface AbstractFunction

getArgumentDesc

public List getArgumentDesc()
Specified by:
getArgumentDesc in interface Function

getReferenceKey

public String getReferenceKey()
Specified by:
getReferenceKey in interface Function
Overrides:
getReferenceKey in interface AbstractFunction

setParameters

public void setParameters(Collection parameters)
            throws InvalidVariableException
Specified by:
setParameters in interface Function
Overrides:
setParameters in interface AbstractFunction

testEnded

public void testEnded()
Specified by:
testEnded in interface TestListener

testEnded

public void testEnded(String host)
Specified by:
testEnded in interface TestListener

testIterationStart

public void testIterationStart(LoopIterationEvent event)
Specified by:
testIterationStart in interface TestListener

testStarted

public void testStarted()
Specified by:
testStarted in interface TestListener

testStarted

public void testStarted(String host)
Specified by:
testStarted in interface TestListener

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