use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestTimeFunction method testYMDnoV.
@Test
public void testYMDnoV() throws Exception {
params.add(new CompoundVariable("YMD"));
variable.setParameters(params);
value = variable.execute(result, null);
assertEquals(8, value.length());
assertNull(vars.get("NAME"));
}
use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestTimeFunction method testHMS.
@Test
public void testHMS() throws Exception {
params.add(new CompoundVariable("HMS"));
variable.setParameters(params);
value = variable.execute(result, null);
assertEquals(6, value.length());
}
use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestTimeFunction method testDefault2.
@Test
public void testDefault2() throws Exception {
params.add(new CompoundVariable());
params.add(new CompoundVariable());
variable.setParameters(params);
long before = System.currentTimeMillis();
value = variable.execute(result, null);
long now = Long.parseLong(value);
long after = System.currentTimeMillis();
assertTrue(now >= before && now <= after);
}
use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestTimeFunction method testFixed.
@Test
public void testFixed() throws Exception {
params.add(new CompoundVariable("'Fixed text'"));
variable.setParameters(params);
value = variable.execute(result, null);
assertEquals("Fixed text", value);
}
use of org.apache.jmeter.engine.util.CompoundVariable in project jmeter by apache.
the class TestTimeShiftFunction method testNowPlusOneDay.
@Test
public void testNowPlusOneDay() throws Exception {
Collection<CompoundVariable> params = makeParams("YYYY-MM-dd", "", "P1d", "");
function.setParameters(params);
value = function.execute(result, null);
LocalDate tomorrow = LocalDate.now().plusDays(1);
LocalDate tomorrowFromFunction = LocalDate.parse(value);
assertThat(tomorrowFromFunction, sameDay(tomorrow));
}
Aggregations