jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Jain <>
Subject Custom function is not picked up
Date Tue, 03 Jul 2012 18:56:42 GMT
I created a function like the one below, and put the class file into a
new jar file in JMeter's lib/ext. But when I use ${__Json()} (e.g. for
the POST body of an HTTP request sampler), I always end up with
'${__Json()}' instead of '{"x":42}'. Built-in functions such as
${__Random(1,10)} work fine. Do I need to register custom functions

package testing;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

import org.apache.jmeter.engine.util.CompoundVariable;
import org.apache.jmeter.functions.AbstractFunction;
import org.apache.jmeter.functions.InvalidVariableException;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.samplers.Sampler;

public class RandomEventFunction extends AbstractFunction {

	private static final String KEY = "__Json";

	public List<String> getArgumentDesc() {
		return Collections.emptyList();

	public String execute(SampleResult previouResult, Sampler sampler) {
		return "{\"x\":42}";

	public String getReferenceKey() {
		return KEY;

	public void setParameters(Collection<CompoundVariable> variable) {


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message