use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestTimeFunction method testDivisorNoMatch.
@Test
public void testDivisorNoMatch() throws Exception {
// trailing space
params.add(new CompoundVariable("/1000 "));
variable.setParameters(params);
value = variable.execute(result, null);
assertEquals("/1000 ", value);
}
use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestTimeFunction method testYMDHMS.
@Test
public void testYMDHMS() throws Exception {
params.add(new CompoundVariable("YMDHMS"));
variable.setParameters(params);
value = variable.execute(result, null);
assertEquals(15, value.length());
}
use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestRegexFunction method testVariableExtractionFromVariable5.
@Test
public void testVariableExtractionFromVariable5() throws Exception {
params = new LinkedList<>();
params.add(new CompoundVariable("(\\d+)\\s+(\\w+)"));
// template
params.add(new CompoundVariable("$2$post"));
// match number
params.add(new CompoundVariable("1"));
// ALL separator
params.add(new CompoundVariable("-"));
params.add(new CompoundVariable("default"));
params.add(new CompoundVariable("OUTVAR"));
params.add(new CompoundVariable(INPUT_VARIABLE_NAME));
variable.setParameters(params);
String match = variable.execute(result, null);
assertEquals("1", vars.getObject("OUTVAR_matchNr"));
assertEquals("timespost", match);
assertEquals("timespost", vars.getObject("OUTVAR"));
assertEquals("123 times", vars.getObject("OUTVAR_g0"));
assertEquals("123", vars.getObject("OUTVAR_g1"));
assertEquals("times", vars.getObject("OUTVAR_g2"));
}
use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestRegexFunction method testVariableExtraction.
@Test
public void testVariableExtraction() throws Exception {
params = new LinkedList<>();
params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
params.add(new CompoundVariable("$2$"));
params.add(new CompoundVariable("2"));
variable.setParameters(params);
String match = variable.execute(result, null);
assertEquals("5", match);
}
use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestRegexFunction method testExtractionIndexTooHigh.
@Test
public void testExtractionIndexTooHigh() throws Exception {
params = new LinkedList<>();
params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
params.add(new CompoundVariable("_$1$"));
params.add(new CompoundVariable("10"));
params.add(new CompoundVariable(""));
params.add(new CompoundVariable("No Value Found"));
variable.setParameters(params);
String match = variable.execute(result, null);
assertEquals("No Value Found", match);
}
Aggregations