0
votes

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

1
I havent used ant so I am not putting this as an answer. But, path that error shows is different then your actual path on the system..Error:-C:\Jmeter_4.0\bin\ApacheJmeter.jar but in actual it is location C:\Jmeter_4.0\apache-jmeter-4.0\bin\ApacheJMeter.jar.....seems like need to fix the path. But, this is just an observation and you can check.sunny_teo
Hey sunny can you be more specific? what to change and where? in the build.xml file? in the folder? remove Jmeter and installed fresh? can you please provide full explanationBastian
Sunny I attached new pic, and the place of the jar file is C:\Jmeter_4.0\apache-jmeter-4.0\bin and the ant is searching in different path, can you please explain hot to change the ant path location?Bastian
hey sunny I changed the build.xml and manage to overcome this issue, the problem is that now jtl file not save any results and it is empty, so I opened an new question stackoverflow.com/questions/50549948/…Bastian
instead of copying jmeter files to ant's bin directory, set your PATH to contain ant's bin directory (as described here ant.apache.org/manual/install.html) . Then cd to jmeter and run ant thereguleryuz

1 Answers

0
votes
  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