Bastian
Bastian

Reputation: 1237

Run Jmeter using ant not working - jmeter jar not found

I am facing an issue for a long time. I want to create html with full Jmeter reports. the only solution is using ant, to run jmeter according some sites.

  1. I installed ant
  2. navigate to C:\Jmeter_4.0\apache-jmeter-4.0\extras and copy all the files (using ctrl +A) + (Ctrl +C)
  3. Navigate to C:\ant\ant\bin and paste all the files (Ctrl +v)
  4. Creating a new text file and called it Test.txt in C:\ant\ant\bin
  5. Change the name of the file and called it Test.jtl
  6. Under C:\ant\ant\bin I opened the build.xml file
  7. I put in -Djmeter.home=.. - C:\Jmeter_4.0\apache-jmeter-4.0
  8. I put in <property name="jmeter.home" value="C:\Jmeter_4.0\apache-jmeter-4.0/.."/>
  9. I opened command line and wrote: cd C:\ant\ant\bin 10.than the command set path=C:\Program Files\Java\jre1.8.0_141\bin

I got error build failed C:\ant\ant\bin.xml:89:jmeter jar file not found or not a vaild file c:\jmeter_4.0\bin\ApachJmeter.jar

I know this is a long question but I am facing it for a long time. hopefully jmeter or someone will make plugin or something to do it easier, just to see all the results in html in one place.

can someone advise what I am missing?

** I noticed that Jmeter.jar exists in the error location, so I do not understand what more need to add.

[enter image description here][copy form jmeter extras]

[enter image description here][copied to ant bin folder]

[enter image description here][create Test.jtl file in ant/bin]

[enter image description here][Modified build.xml in ant bin]

[enter image description here][Run command and get errors]

[enter image description here][Jmeter jar exists]

enter image description here

Upvotes: 0

Views: 726

Answers (1)

Dmitri T
Dmitri T

Reputation: 168072

  1. I don't see you're applying your point 7.
  2. Your point 8 is pointing to the wrong location

You should be running your test as:

ant -Djmeter.home=c:\Jmeter_4.0\apache-jmeter-4.0

or alternatively you can hard-code path to your JMeter installation into your build.xml file like:

<property name="jmeter.home" value="C:/Jmeter_4.0/apache-jmeter-4.0"/>

When you override property value using -D command-line argument there Ant doesn't the properties defined in the build.xml file into consideration, it will use what you pass in the command line. See Properties and PropertyHelpers Ant User Manual chapter for more details.

Going forward I would recommend you adding jmeterlogfile parameter to jmeter task like:

 <jmeter
    jmeterhome="${jmeter.home}"
    testplan="${testpath}/${test}.jmx"
    resultlog="${testpath}/${test}.jtl"
    jmeterlogfile="/path/to/jmeter.log">

This way you will be able to get jmeter.log file generated at the defined location, in the majority of cases it will help to troubleshoot the issue. More information: How to Configure JMeter Logging

Upvotes: 0

Related Questions