JMeter JKnowledge: Properties and Variables

JMeter JKnowledge is a chance to take a moment away from the tutorials and learn a little bit more about some of the concepts we have been or will be using.

It’s very important as your tests become more complicated, and we move ever closer to taking our functional testing work and utilizing it to perform load and performance testing, that we have a good understanding of what Properties and Variables are in JMeter, as well as their benefits and limitations.

Continue reading “JMeter JKnowledge: Properties and Variables”

Functional Testing 09: Life in a Beanshell

Ninth in a series focusing on using JMeter for functional testing of an API.

In the last tutorial we jumped through some hoops in order to be able to extra one folderid from a list of folders. Some of the decision we made would end up causing us problems later on. For instance, the way we extracted a folderid would require us to provide a folderIndex every time we used GetFolders. Since that may not always be the case, it would actually require us to do more work in the instance when we didn’t need to extract a folderid.

In this tutorial, we will replace some of what we did last time with a BeanShell object and write a little bit of Java too.

Continue reading “Functional Testing 09: Life in a Beanshell”

Functional Testing 08: Using Response Data – Part 2

Eighth in a series focusing on using JMeter for functional testing of an API.

In the last tutorial we used the response from Signin in to make another call to the API. Now we’ll take it one step further. We’ll introduce a little bit of validation to our Folders Sampler Library module in order to be able to make one more call to get the list of files within a folder. We’ll also introduce a little bit of randomness to our test, in a way that we will improve on in the next tutorial when things really start to get fun.

Continue reading “Functional Testing 08: Using Response Data – Part 2”

Functional Testing 07: Using Response Data – Part 1

Seventh in a series focusing on using JMeter for functional testing of an API.

Quite often you will need to use data from one API response to make another subsequent API call. In this tutorial we we will see how to use the token returned by signing in to make an authorized API call to another API end point which requires you to be signed in (we will get a list of folders).

We are really going to start testing now!

Continue reading “Functional Testing 07: Using Response Data – Part 1”

Functional Testing 06: Getting Started with Debugging Your Tests

Sixth in a series focusing on using JMeter for functional testing of an API.

Unlike every software developer I have ever known, I make mistakes. And you will too, especially as you begin creating more and more complex tests. And when you see your tests doing things you don’t expect (or not doing things you do expect) it helps to know how to go about debugging the problem.

So, let’s take a break from building our tests and learn about a couple of the ways we can poke at JMeter to figure what’s going wrong when things don’t work.

Continue reading “Functional Testing 06: Getting Started with Debugging Your Tests”

Functional Testing 05: Negative Validation or When Bad is Good

Fifth in a series focusing on using JMeter for functional testing of an API.

When is it good for a test fail? When you expect it to!

In the last tutorial we created validation on our Signin Library module to make sure that when we expected the test to pass that we got back the data we expected. Our test would then fail when we expected correct data but got something else. But what about when we need to make sure something correctly fails? What if we want to intentionally provide bad data and make sure that the application returns the correct error?

It’s called negative Validation, and we will tackle it in this tutorial.

Continue reading “Functional Testing 05: Negative Validation or When Bad is Good”

Functional Testing 04: Everyone Needs a Little Validation

Fourth in a series focusing on using JMeter for functional testing of an API.

So far we have relied solely on JMeter’s built in ability to tell if our API calls have passed or failed based on the HTTP response code we receive from the server. So a Signin response returning a 200 code would display as a pass (or success) and a 401 code would display as a failure.

This will often not be enough to validate the response from the server was in fact correct. The server could return a good response code but send bad data back which could cause problems down the line. In this tutorial we’ll enhance our Library module for Signin to validate that we are getting a token field in the response. It will be a very simple introduction to some more complicated validation we will do in a later module.

Continue reading “Functional Testing 04: Everyone Needs a Little Validation”

Functional Testing 03: But Wait! Not Too Lazy!

But Wait! addendum to tutorials are optional side topics, not necessary to continue progress through the tutorials, but that may skip ahead in concepts in order to expand on a topic.

In Functional Testing 03: Let’s Be Lazy you’ll notice I may have taken the laziness too far. In the tutorial I used the dreaded “copy and paste” method to create a second test. To those of us that have many, many tests this sends shivers down our spines. Our signin tests only had two tests but if we had wanted to run a hundred different signin tests copy and paste would not be the best solution.

So let’s take a little time to understand how we could remove the copy/paste.

Continue reading “Functional Testing 03: But Wait! Not Too Lazy!”

Functional Testing 03: Let’s Be Lazy

Third in a series focusing on using JMeter for functional testing of an API.

Sometimes laziness is a good thing. Sure laziness can result in nothing getting done. But laziness can sometimes result in MORE getting done. So let’s strive to be lazy, but lazy in a way that empowers us to do more!

In this tutorial, we will take what we’ve learned about Samplers and Variables, and combine it with some new concepts that will make our work reusable across our test plan. We will learn how to create a library of samplers which are parameterized to allow us to call them many different ways in many different tests.

Continue reading “Functional Testing 03: Let’s Be Lazy”

Functional Testing 02: Preparation is the Key to Success

Second in a series focusing on using JMeter for functional testing of an API.

A little preparation will save us tons of time later when everything changes. And everything is always certain to change.

After the fun excitement of the first tutorial in which we made our very first API call with JMeter, we are going step back and do some very boring preparation for the future. One thing we can be certain of is that changes happen in software projects. A small amount of effort put in early in a project can greatly help reduce the headache of updates and maintenance later down the timeline. So in this tutorial we start venturing down the path to setting up our test plan to be able to weather changes in API location, paths, and http ports, and more.

Continue reading “Functional Testing 02: Preparation is the Key to Success”