Search in sources :

Example 31 with StringProperty

use of org.apache.jmeter.testelement.property.StringProperty in project jmeter by apache.

the class PackageTest method testParseExample4.

@Test
public void testParseExample4() throws Exception {
    StringProperty prop = new StringProperty("html", "${non-existing function}");
    JMeterProperty newProp = transformer.transformValue(prop);
    newProp.setRunningVersion(true);
    assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
    assertEquals("${non-existing function}", newProp.getStringValue());
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) StringProperty(org.apache.jmeter.testelement.property.StringProperty) Test(org.junit.Test)

Example 32 with StringProperty

use of org.apache.jmeter.testelement.property.StringProperty in project jmeter by apache.

the class PackageTest method testNestedExample2.

@Test
public void testNestedExample2() throws Exception {
    StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</html>,$1$)}");
    JMeterProperty newProp = transformer.transformValue(prop);
    newProp.setRunningVersion(true);
    assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
    assertEquals("hello world", newProp.getStringValue());
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) StringProperty(org.apache.jmeter.testelement.property.StringProperty) Test(org.junit.Test)

Example 33 with StringProperty

use of org.apache.jmeter.testelement.property.StringProperty in project jmeter by apache.

the class PackageTest method testParseExample10.

@Test
public void testParseExample10() throws Exception {
    StringProperty prop = new StringProperty("html", "${__regexFunction(\\ " + "(\\\\\\$\\d+\\.\\d+\\,\\\\$\\d+\\.\\d+),$1$)}");
    JMeterProperty newProp = transformer.transformValue(prop);
    newProp.setRunningVersion(true);
    assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
    assertEquals("$3.47,$5.67", newProp.getStringValue());
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) StringProperty(org.apache.jmeter.testelement.property.StringProperty) Test(org.junit.Test)

Example 34 with StringProperty

use of org.apache.jmeter.testelement.property.StringProperty in project jmeter by apache.

the class PackageTest method testNestedExample1.

@Test
public void testNestedExample1() throws Exception {
    StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</html>," + "$1$)}${__regexFunction(<html>(.*o)(.*o)(.*)" + "</html>,$1$$3$)}");
    JMeterProperty newProp = transformer.transformValue(prop);
    newProp.setRunningVersion(true);
    assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
    assertEquals("hello worldhellorld", newProp.getStringValue());
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) StringProperty(org.apache.jmeter.testelement.property.StringProperty) Test(org.junit.Test)

Example 35 with StringProperty

use of org.apache.jmeter.testelement.property.StringProperty in project jmeter by apache.

the class PackageTest method testParseExample12.

// N.B. See Bug 46831 which wanted to changed the behaviour of \$
// It's too late now, as this would invalidate some existing test plans,
// so document the current behaviour with some more tests.
// Escaped dollar commma and backslash with variable reference
@Test
public void testParseExample12() throws Exception {
    StringProperty prop = new StringProperty("html", "\\$a \\, \\\\ \\x \\ ${server} \\$b \\, \\\\ cd");
    JMeterProperty newProp = transformer.transformValue(prop);
    newProp.setRunningVersion(true);
    // N.B. Backslashes are removed before dollar, comma and backslash
    assertEquals("$a , \\ \\x \\ jakarta.apache.org $b , \\ cd", newProp.getStringValue());
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) StringProperty(org.apache.jmeter.testelement.property.StringProperty) Test(org.junit.Test)

Aggregations

StringProperty (org.apache.jmeter.testelement.property.StringProperty)47 Test (org.junit.Test)26 JMeterProperty (org.apache.jmeter.testelement.property.JMeterProperty)23 ConfigTestElement (org.apache.jmeter.config.ConfigTestElement)9 TestElement (org.apache.jmeter.testelement.TestElement)7 TestPlan (org.apache.jmeter.testelement.TestPlan)4 TestElementProperty (org.apache.jmeter.testelement.property.TestElementProperty)3 BeanInfo (java.beans.BeanInfo)2 IntrospectionException (java.beans.IntrospectionException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 ResourceBundle (java.util.ResourceBundle)2 CompoundVariable (org.apache.jmeter.engine.util.CompoundVariable)2 ReplaceStringWithFunctions (org.apache.jmeter.engine.util.ReplaceStringWithFunctions)2 TestSampler (org.apache.jmeter.junit.stubs.TestSampler)2 BooleanProperty (org.apache.jmeter.testelement.property.BooleanProperty)2 CollectionProperty (org.apache.jmeter.testelement.property.CollectionProperty)2 NullProperty (org.apache.jmeter.testelement.property.NullProperty)2 JMeterContext (org.apache.jmeter.threads.JMeterContext)2