Fwd: Trying to run a jmeter script through a testng Test and fails

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Trying to run a jmeter script through a testng Test and fails

Chamara Ariyarathne
Hi all,

I'm trying to run a jmeter script with the following Test method in testng
and my maven build fails like following. Any help in resolving this matter
will be appreciated.

*Method: *

    @Test
    public void runJmeter() throws Exception {
        StandardJMeterEngine jmeter = new StandardJMeterEngine();

        JMeterUtils.setJMeterHome("/home/chamara/Programs/apache-jmeter-3.2
");
        JMeterUtils.loadJMeterProperties("/home/
chamara/stress-test-framework/src/test/resources/CUSTOM/user.properties");
        JMeterUtils.initLogging();
        JMeterUtils.initLocale();

        SaveService.loadProperties();

        FileInputStream in = new FileInputStream("/home/
chamara/stress-test-framework/src/test/jmeter/CUSTOM/
Concurrency_Thread_Group.jmx");
        HashTree testPlanTree = SaveService.loadTree(in);
        in.close();

        jmeter.configure(testPlanTree);
        jmeter.run();


    }

*Failure: *

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.wso2.stress.StressTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.
TestNG652Configurator@2db0f6b2
INFO    2017-11-07 18:35:18.029 [jmeter.e] (): Listeners will be started
after enabling running version
INFO    2017-11-07 18:35:18.041 [jmeter.e] (): To revert to the earlier
behaviour, define jmeterengine.startlistenerslater=false
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.389 sec
<<< FAILURE!
runJmeter(org.wso2.stress.StressTest)  Time elapsed: 0.199 sec  <<< FAILURE!
java.lang.NullPointerException
at org.apache.jmeter.engine.StandardJMeterEngine.configure(
StandardJMeterEngine.java:164)
at org.wso2.stress.StressTest.runJmeter(StressTest.java:31)


--
*Chamara Ariyarathne*
WSO2 Inc; http://www.wso2.com/
Mobile; *+94772786766 <077%20278%206766>*
Reply | Threaded
Open this post in threaded view
|

Re: Trying to run a jmeter script through a testng Test and fails

jmeter tea
It seems that you have extra sapces in path: ("/home/
chamara/stress-test-framework/src/test/jmeter/CUSTOM/
Concurrency_Thread_Group.jmx");

Try with ("/home/chamara/stress-test-framework/src/test/jmeter/CUSTOM/
Concurrency_Thread_Group.jmx");

On Wed, Nov 8, 2017 at 4:28 AM, Chamara Ariyarathne <[hidden email]>
wrote:

> Hi all,
>
> I'm trying to run a jmeter script with the following Test method in testng
> and my maven build fails like following. Any help in resolving this matter
> will be appreciated.
>
> *Method: *
>
>     @Test
>     public void runJmeter() throws Exception {
>         StandardJMeterEngine jmeter = new StandardJMeterEngine();
>
>         JMeterUtils.setJMeterHome("/home/chamara/Programs/apache-
> jmeter-3.2
> ");
>         JMeterUtils.loadJMeterProperties("/home/
> chamara/stress-test-framework/src/test/resources/CUSTOM/user.properties");
>         JMeterUtils.initLogging();
>         JMeterUtils.initLocale();
>
>         SaveService.loadProperties();
>
>         FileInputStream in = new FileInputStream("/home/
> chamara/stress-test-framework/src/test/jmeter/CUSTOM/
> Concurrency_Thread_Group.jmx");
>         HashTree testPlanTree = SaveService.loadTree(in);
>         in.close();
>
>         jmeter.configure(testPlanTree);
>         jmeter.run();
>
>
>     }
>
> *Failure: *
>
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running org.wso2.stress.StressTest
> Configuring TestNG with: org.apache.maven.surefire.testng.conf.
> TestNG652Configurator@2db0f6b2
> INFO    2017-11-07 18:35:18.029 [jmeter.e] (): Listeners will be started
> after enabling running version
> INFO    2017-11-07 18:35:18.041 [jmeter.e] (): To revert to the earlier
> behaviour, define jmeterengine.startlistenerslater=false
> Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.389 sec
> <<< FAILURE!
> runJmeter(org.wso2.stress.StressTest)  Time elapsed: 0.199 sec  <<<
> FAILURE!
> java.lang.NullPointerException
> at org.apache.jmeter.engine.StandardJMeterEngine.configure(
> StandardJMeterEngine.java:164)
> at org.wso2.stress.StressTest.runJmeter(StressTest.java:31)
>
>
> --
> *Chamara Ariyarathne*
> WSO2 Inc; http://www.wso2.com/
> Mobile; *+94772786766 <077%20278%206766>*
>