Follow

Creating A JMeter Test

Step 1 : Write Your Script

There are various ways to get your script done:

  1. Use the BlazeMeter Chrome Extension to record your scenario 
  2. Use the JMeter HTTP(S) Test Script Recorder. This sets up a proxy so you could run your test through and record everything
  3. Go manually all-the-way and construct everything from scratch. This is more common for functionality/QA tests

If you get your script from a recording (as in steps 1 & 2), keep in mind that:

  1. You'll need to change certain parameters, such as Username & Password, or you might want to set a CSV file with those values so each user can be unique.
  2. You might need to extract elements such as as Token-String, Form-Build-Id and others using Regular Expressions, JSON Path Extractor, XPath Extractor. This will enable you to complete requests like "AddToCart", "Login" and more...See this article regarding these procedures
  3. You should keep your script parameterized and use configuration elements like HTTP Requests Defaults to make your life easier when switching between environments.

Step 2 : Testing Locally With JMeter

Start debugging your script with one thread, one iteration, and using the 'View Results Tree' element, Debug Sampler and Dummy Sampler. Keep the Log Viewer open in case any JMeter errors are reported.

Go over the True and False responses of all the scenarios to make sure the script is performing as you expected.

After the script has run successfully using one thread, raise it to 0-20 threads for ten minutes and check:

  1. Are the users coming up as unique (if this was your intention)?
  2. Are you getting any errors?
  3. If you're running a registration process, take look at your backend - are the accounts created according to your template? Are they unique?
  4. Test statistics on the summary report - do they make sense (in terms of average response time, errors, hits/s)?

Once your script is ready:

  1. Clean it up by removing any Debug/Dummy Samplers and deleting your script listeners.
  2. If you use the Listeners (such as "Save Responses to a file"), make sure you don't use any Paths! If it's a Listener or a 'CSV Data Set Config' make sure you don't use the path you've used locally and use only the filename instead (as if it was on the same folder as your script)
  3. If you're using your own proprietary JAR file(s), upload them to BlazeMeter along with the JMX.
  4. If you're using more than one Thread Group (or not the standard one) -  set the values before uploading them to BlazeMeter, and make sure to uncheck the 'Threads' and 'Users' scrollers in BlazeMeter's test configuration page so the values will be pulled from the Thread Groups.

Step 3 : Uploading your JMX and the tests assets

You can start creating your Jmeter test by clicking on the "Create Test" button on the top navigation bar and then select Jmeter Test. Do not forget to create the test within the relevant Project. 

On the top left section of the screen you'll find a central location to upload the JMX.

  • All the files in your account are downloaded to the remote JMeter servers at the beginning of each test.
  • During the test, the files in your account are synchronized every few minutes.
  • You cannot delete files during the load test. Files can be deleted only once the test has ended or before it has started.

If you require more information regarding uploading files to the test configuration page, please refer to this article.

Under the 'Load Scenario Properties' section, you have the option to select the Location that you want your test to be run in.

You can control and override Jmeter's configuration by moving the markers along the sliders. Heres a quick explanation of each one:

  • Users. Select the number of users you want. The engines and thread are adjusted automatically according to this number.
  • Engines and Threads: If you don't want these to be set automatically, you can manually set them by unchecking the Users section. Note: Free-tier users don't have access to engines and are limited to 50 threads.
  • Ramp Up: Select how fast you want the test to ramp up.
  • Iterations: Select the number of iterations in the test. Note: this is automatically set to infinitive
  • Duration: Set the full time duration that you want the test to run
  • Delay: Set the duration of the delay between each page request.
  • Limit RPS: Set the number of Requests per second you do not wish to go over.

    Now that you've set up your test, you can choose to receive an 'Email on report end'.

    All done? Now just give it a name, click save and you're Jmeter test is ready to go!

Advanced Options

  • Jmeter version - Choose the Jmeter version you would like to run the test on. While this is your choice to make,  we strongly advise on choosing the latest Jmeter release.
  • Java version - Choose the JAVA version you would like to run the test on - 1.7 or 1.8.
  • Test Failure Criteria: Set failure criteria for various metrics in order to fail the test if needed.
  • DNS - Hostname Override: Use this if you want to tell the JMeter engine not to automatically go to the DNS, but to use a specific IP record instead. Just enter the appropriate IP and redirect your script without changing your labels. If you have a JMeter script (which will be explained later in this document), you dont need to change your script in order to redirect the load between your staging and your production environments.
  • JMeter Properties - Here you can set your JMeter parameters. This is a real-time feature. e.g,  you may want to add hits and give it the value 100 - or maybe type in execute - true. These parameters will be sent to the engine while running the script.
  • Command Line Arguments - Here you can send  command line variables straight to the Console or engine properties files. e.g, if you want to send something to the JMeter properties file, you can do it from here. Just bear in mind that youre overriding parameters here so if you make a mistake, it could ruin your test! So use this with caution.
  • Network Emulation: Here you can select any kind of preset to emulate your network connection (mobile or web), the bandwidth and latency.
  • New Relic APM: Just enter your New Relic API key here and youll be able to select profiles.
  • New Relic Insights: Enter your credentials to access New Relic Insights.
  • Cloudwatch: Integrate you AWS application monitoring tool and and youll be able to select profiles and view your Application server's side KPIs.
  • There is one additional feature here - the Split CSV.
  • Dynatrace APM: Integrate your Dynatrace APM agent with the BlazeMeter test in order to send metrics to the on-premise Dynatrace application.
  • AppDynamics APM: Integrate your AppDynamics APM profiles with BlazeMeter's tests.

    You can upload a CSV in the same place that you upload your JMeter scripts (make sure that you remove the path from the CSV data set configuration controller as the files will share the same folder). If you do this and you have more than one engine, you probably wont want two engines to execute the same login for the same user. So here you can check the Split CSV option, and the users will be sent randomly to the engines (i.e. line one will go to engine one, line two to engine two, line three to engine one etc.)

For more information on using  CSV file in your test, please refer to this article.

Once again, Make sure you name your test, save it and you're ready to go! Great! Youve now successfully set up your Jmeter test. Ready to move on to the next step? Read our article on Running BlazeMeter Tests to find out how.

Sandbox Testing

The SandBox is actually a test which has up to 20 users, using 0 engines and runs for up to 20 minutes.

The SandBox configuration allows you to test your script and backend and ensure everything works well logically.

Here are some common issues you might come across:

  1. Firewall - make sure your environment is open to the BlazeMeter CIDR list and whitelist them.
  2. Make sure all of your test files e.g: CSVs, JAR, JSON, User.properties etc. are present.
  3. Make sure you didn't use any paths.

If you're still having trouble, look at the logs for errors (you should be able to download the entire log).

A SandBox configuration can be:

  • Engines: Console only (1 console , 0 engines)
  • Threads: 1-20
  • Ramp-up: 0-1200 seconds.
  • Iteration: Test continues forever
  • Duration: 1-20 minutes

This will allow you to get enough data during your ramp-up period to analyze the results and ensure the script was executed as you expected.

Want to learn more about running JMeter tests from BlazeMeter? Watch our on-demand recording, How to Make JMeter Highly Scalable and More Collaborative With BlazeMeter.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.