13

I use Blazemeter Chrome Extension to record my Jmeter Test Plans. These recorded scripts are very helpful as they record cookies, variables and sessions that are required and I don't need to take the headache of doing all that manually. These scripts run perfectly fine in the GUI mode of Jmeter.

The problem I'm facing is to execute the same Test Plan in non GUI (from command line) mode. I haven't changed/modified the jmx file that was executing perfectly in the GUI mode. Now when I try to run the test from command line using below command It returns with an error saying "Could not open Test.jmx". That is, jmeter is not able to open the Test Plan file when executing in non GUI mode.

jmeter -n -t Test.jmx -l results.jtl

  • I think full command is jmeter -n -t Test.jmx example.jtl , you missing jtl file name? – Helping Hands Jan 8 '16 at 7:08
  • What error is returned? and have you tried giving complete path to jmx file? – TestingWithArif Jan 8 '16 at 7:40
  • 9
    @ Helping Hands, I've edited the command to the actual thing that I tried. – IAmMilinPatel Jan 8 '16 at 8:40
  • 10
    @ TestingWithArif The error I've mentioned in the description above and yes I tried it with the absolute path as well but still got the same result. Infact when I created a simple test plan in Jmeter GUI with just 1 http request sampler and tried that in non GUI mode, it worked fine. – IAmMilinPatel Jan 8 '16 at 8:42
12

After a lot of Googling and trial and error I found out that a tag in the JMX file that Blazemeter's Chrome Extension generates was creating a problem.

The JMX file included a <hashTree/> in several places and this tag was causing the JMX file to not being read by Jmeter in non GUI mode.

So I removed this tag and tried to run the test and got a hell lot more errors than earlier.

Then I added 2 asterisks [**] before and after the hashTree tag. So the tag now looked like **<hashTree/>** and saved the JMX file.

Now when I ran the test via non GUI mode it executed perfectly fine.

Happy Testing :)

Patel Milin

  • 2
    You can accept it as answer :) I guess it could also be reported to Blazemeter team! – TestingWithArif Jan 12 '16 at 4:49
  • 10
    Yep wrote an email to Blazemeter support, but as per them there is nothing wrong with the way test plan is being generated! So lets see if they really do fix it. Otherwise we'll have ti do this one thing manually every time! :) – IAmMilinPatel Jan 12 '16 at 5:04
  • Thats strange. I will check in my environment and share here. If it works fine for me then may be there is something else in your environment causing the issue! – TestingWithArif Jan 12 '16 at 5:17
  • 1
    adding ** did not solve my issue but restarting my mac did. I am serious and not kidding – Tarun Jan 30 '17 at 9:05
  • Didn't work for me, and reboot also didn't work either :( – David Aug 24 '17 at 4:56
0

Try to pass the jmx file within quotes as below - worked for me

jmeter -n -t "Test.jmx" -l results.jtl

0

The solution is not necessarily related to the question here but as I came here, I feel it proper to put my solution here. I was getting 'Could not open plan.jmx'

If you are getting simply that in the command line, then make sure that you have given the file name correctly considering capital small abcd in your command.

[I am using ubuntu so command got slight variety compared to Windows]

so,

  1. './jmeter -n -t plan.jmx -l plan.csv' and
  2. './jmeter -n -t Plan.jmx -l plan.csv' are different.

Names of the file in my case are Plan.jmx and plan.csv. [capital P in jmx]

I ran the first command, and during surf, I landed on this page. Then I tried 2nd one and worked.

[before that I had file names like 'Test Plan', but that space case also was giving me trouble in some other way. was getting 'An error occurred: Unknown arg: Plan.jmx', so I renamed the file from 'save as' option, but _ or - in the file name can be used.]

  • Hi Hemraj, yes the answer isn't related to the question. It's obvious that on UBUNTU plan.jmx and Plan.jmx are considered 2 different files and hence the failure. UBUNTU is case sensitive. Also Test Plan.jmx breaks because of the space in the path. Terminal considers Test as a option and expects a parameter/argument for it. whenever there is a space in the file/folder name try passing that within double quotes "Test Plan.jmx" on the terminal and it will work. – IAmMilinPatel Nov 25 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.