Hi,

I am working quite some time with jMeter now but this is the first time I
want to start several jMeter Tests from my own code.

Basically, I copied from here:
http://blazemeter.com/blog/5-ways-launch-jmeter-test-without-using-jmeter-gui
The JMX-File has been created with the GUI containing two variables.

The HTTP Sampler contains in the "Server name or IP" field: ${__P(server)}
The Path field contains: /${__P(target)}

The respective entries in the jmeter.properties file are:

server=127.0.0.1
target=README

When running in jMeter, both values get replaced and the correct URL is
passed.
When accessing the both properties during Runtime in my java code it yields
the correct results.

When jMeter tries to replace my values, I get this message: "Not running
version, return raw function string"

I tried to trace down the problem in the jmeter sources but did not get to
a result.

The Java code I use is:

public static void main(String[] args) throws IOException {

    StandardJMeterEngine jmeter = new StandardJMeterEngine();

JMeterUtils.loadJMeterProperties("C:\\data\\apache-jmeter-2.13\\bin\\jmeter.properties");
    JMeterUtils.setJMeterHome("C:\\data\\apache-jmeter-2.13");
    JMeterUtils.initLocale();
    System.out.println("Property: " + JMeterUtils.getProperty("server"));
    SaveService.loadProperties();
    FileInputStream in = new FileInputStream("c:\\data\\test.jmx");
    HashTree testPlanTree = SaveService.loadTree(in);
    in.close();
    jmeter.configure(testPlanTree);
    jmeter.run();
}

Any help is highly appreciated.


Best regards, Jan

Reply via email to