.NET Core Performance Testing using Apache JMeter – Part 3

Introduction

In the previous post on this topic, we’ve setup a simple JMeter performance test which is making HTTP Calls to a .NET Core API Endpoint.

The test we performed, was making calls to an unauthorized API Endpoint. Today, we will see how to make HTTP calls to an endpoint which is protected by JWT authentication mechanism. We all also learn few more items in JMeter.

This is how our current Test setup looks like:

Get User Authentication Token

I am assuming you are aware of how JWT works in APIs. I also have written few posts on this topic, you can refer to those if you are totally new to JWT.

The process is very simple. To make an HTTP call to an authorized endpoint, we shall include bearer token to our HTTP Request as an Authorization header. That means that first, we need to get a bearer token by providing username and password, store it somewhere and then use it in different HTTP Calls as an Authorization Header. Here are the steps

  • Get JWT (bearer token) by providing a username/password to API Endpoint.
  • Use it in authorization header for HTTP calls to authorized endpoints

In our target .NET Core API, we have an endpoint which provides a token as shown below:

Subscribe to continue reading

Subscribe to get access to the rest of this post and other subscriber-only content.