use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestSetProperty method testSetPropertyWithReturn.
@Test
public void testSetPropertyWithReturn() throws Exception {
params.add(new CompoundVariable("prop1"));
params.add(new CompoundVariable("value1"));
params.add(new CompoundVariable("true"));
function.setParameters(params);
String returnValue = function.execute(result, null);
assertEquals("value1", JMeterUtils.getProperty("prop1"));
Assert.assertNull(returnValue);
params.clear();
params.add(new CompoundVariable("prop1"));
params.add(new CompoundVariable("value2"));
params.add(new CompoundVariable("true"));
function.setParameters(params);
returnValue = function.execute(result, null);
assertEquals("value2", JMeterUtils.getProperty("prop1"));
assertEquals("value1", returnValue);
}
use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestSimpleFunctions method testEscapeXml.
@Test
public void testEscapeXml() throws Exception {
AbstractFunction function = new EscapeXml();
params.add(new CompoundVariable("\"bread\" & <'butter'>"));
function.setParameters(params);
String ret = function.execute(result, null);
assertEquals(""bread" & <'butter'>", ret);
}
use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestGroovyFunction method testFileLoading.
@Test
public void testFileLoading() throws Exception {
JMeterUtils.setProperty("groovy.utilities", "bin/utility.groovy");
params.add(new CompoundVariable("factorial(10)"));
function.setParameters(params);
String ret = function.execute(result, null);
assertEquals("3628800", ret);
}
use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestGroovyFunction method testReplace1.
@Test
public void testReplace1() throws Exception {
params.add(new CompoundVariable("prev.getResponseDataAsString().replaceAll('T','t')"));
function.setParameters(params);
String ret = function.execute(result, null);
assertEquals("the quick brown fox", ret);
}
use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestGroovyFunction method testSumVar.
@Test
public void testSumVar() throws Exception {
params.add(new CompoundVariable("1+2+3"));
params.add(new CompoundVariable("TOTAL"));
function.setParameters(params);
String ret = function.execute(result, null);
assertEquals("6", ret);
assertEquals("6", vars.get("TOTAL"));
}
Aggregations