Search in sources :

Example 56 with JMeterProperty

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

the class PackageTest method testParseExample9.

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

Example 57 with JMeterProperty

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

the class PackageTest method testParseExample13.

// Escaped dollar commma and backslash with missing variable reference
@Test
public void testParseExample13() throws Exception {
    StringProperty prop = new StringProperty("html", "\\$a \\, \\\\ \\x \\ ${missing} \\$b \\, \\\\ cd");
    JMeterProperty newProp = transformer.transformValue(prop);
    newProp.setRunningVersion(true);
    // N.B. Backslashes are removed before dollar, comma and backslash
    assertEquals("$a , \\ \\x \\ ${missing} $b , \\ cd", newProp.getStringValue());
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) StringProperty(org.apache.jmeter.testelement.property.StringProperty) Test(org.junit.Test)

Example 58 with JMeterProperty

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

the class PackageTest method testParseExample8.

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

Example 59 with JMeterProperty

use of org.apache.jmeter.testelement.property.JMeterProperty 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 60 with JMeterProperty

use of org.apache.jmeter.testelement.property.JMeterProperty 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)

Aggregations

JMeterProperty (org.apache.jmeter.testelement.property.JMeterProperty)87 StringProperty (org.apache.jmeter.testelement.property.StringProperty)23 Test (org.junit.Test)23 PropertyIterator (org.apache.jmeter.testelement.property.PropertyIterator)13 CollectionProperty (org.apache.jmeter.testelement.property.CollectionProperty)12 Argument (org.apache.jmeter.config.Argument)11 ArrayList (java.util.ArrayList)9 HTTPArgument (org.apache.jmeter.protocol.http.util.HTTPArgument)8 File (java.io.File)7 Arguments (org.apache.jmeter.config.Arguments)7 HTTPFileArg (org.apache.jmeter.protocol.http.util.HTTPFileArg)6 TestElement (org.apache.jmeter.testelement.TestElement)6 ConfigTestElement (org.apache.jmeter.config.ConfigTestElement)5 URL (java.net.URL)4 TestElementProperty (org.apache.jmeter.testelement.property.TestElementProperty)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 HashMap (java.util.HashMap)3 Sampler (org.apache.jmeter.samplers.Sampler)3 TestPlan (org.apache.jmeter.testelement.TestPlan)3 NullProperty (org.apache.jmeter.testelement.property.NullProperty)3