Using J-Meter to upload CSV details via an endpoint

Maureen Josephine
podiihq
Published in
4 min readFeb 23, 2020

What’s J-Meter?

J-Meter is open-source software designed to load test functional behavior and measure performance. You can use J-Meter to analyze and measure the performance of web applications or a variety of services. Performance Testing means testing a web application against heavy load, multiple and concurrent user traffic.

Use Case

J-Meter is of great help in sending bulk details, for instance, a thousand records of users into an existing table into the database via an endpoint as an alternative way to writing an update query.

For this sample, we are going to upload employee data to the database using the dummy API http://dummy.restapiexample.com/

Steps.

  1. Install J-Meter.

If you don’t have J-Meter installed. Make sure to download the latest version of J-Meter and follow the installation guides depending on your Operating System as stated in Jmeter installation guides.

2. Build Your First JMeter Test Plan.

A Test Plan is where you place the overall settings and the steps that you would like J-Meter to execute as it runs. To create a Test Plan you’re required to set the thread group. A thread group is where you specify the number of users that you want to simulate. One thread = one user.

Check as the sample image below

3. Configure your Test Plan.

It's important to configure your test Plan with the required settings that will enable you to update the data to the database using the right functional endpoint.

i). First set up your Http Header Manager indicating the content-Type and Authorization providing the valid bearer Token if the endpoint requires one. See the image below as an example

ii). Secondly, place your HTTP requests domain URL as shown below

Http Request details

iii) Describe and set up your thread Group specifying your number of users and action to be taken after a sampler error.

iv) Configure the CSV data set by placing the file path to the CSV within your local device and placing the variable names as they appear in the titles of different columns of the CSV file that you want to upload its details.

The data in CSV file to be uploaded

Employee details in the CSV file

v) To set up the HTTP Request, place the path to the endpoint you want to use to upload data. For instance, I used this /api/v1/create.

Select the method of the request you want to do, eg. POST, PUT, PATCH among others. For this, I will use POST since I want to create new data that is not existing at all in the database.

Also, make sure the body data placed in J-meter is in the form of JSON placing the Keys and values like {“name”: “${name}”.

Find out more from the image below.

http request method and body

vi) After setting the configs you can then run the app to send the data to the database with the first green button from your left as shown below

vii) You can then view the results from the Results tree. You can confirm by the 200 Response code. You can have a look at this image.

Sampler result

You can clearly see that the request matches the request we sent using data that we needed to upload that was placed in the CSV file, from the results view tree as shown below

Sample request data

You can have a look at the response from the image below

Sample response data

You can then confirm your uploaded details by querying from the database.

Thank you! Happy learning😃

--

--

Maureen Josephine
podiihq

Flutter enthusiast! Back-end Developer | JavaScript User | Elixir|Phoenix Learner, _The best way to learn about something is to write about it_