Functional Software Testing is the technique used to test the features and functionality of a system or software. Functional testing aims to answer questions like “can the user do this?” or “does this feature work?”. After this brief definition, let’s answer questions such as; “What is a functional test with JMeter?”, how it can be done effectively.
Functional test sample with JMeter
Functions to be tested.Github.com’s home page and login page.
In order to prepare a test scenario in JMeter, we must first test the scenario in a Web Browser, capture the requests made with our browser’s developer tools or Findler, HTTP Proxy tools, and configure them in JMeter in the same order and sequence. As an alternative to this method and more practically, the JMeter test scenario can be prepared by arranging the saved Requests by ensuring that all requests made from the browser are passed through JMeter (using JMeter as a proxy).
Create a new Test Plan in JMeter and set its name as “Github Functional Test” and save the Test Plan. Then create a recording (Templates -> Recording -> Create) You should see a screenshot as below.
Click on HTTP (S) Test Script Recorder and press the Start button. Go to “github.com” address on the browser where you set the proxy settings and press the “Sign in” button. Stop the recorder at JMeter. You should see a screenshot like the one below.
We have realized two functions that we have included in the “Functions to Test” section. Let’s run it and see the result.
Here is our Github login screen.
Now let’s see if these functions work as we want by adding assertion. In the scenarios tested in the function tests, the responses to the requests made to the server should be examined in detail and it should be checked whether the expected answers have actually been received. Let’s add Response Assertion to both the home page and login page as follows. It can be added by right-clicking (Add> Assertions> Response Assertion) this menu.
Let’s check if it says “Github” in the Home Response Assertion section and if it says “How people build software” in the Login Response Assertion section.
When we run JMeter, our result is as follows.
The homepage found the text “Github” and gave us the green color. Since “How people build software” cannot be found on the login page, we see that the relevant step is colored red.
We wrote our Github functional test on JMeter, now let’s see how we will run the functional test on Loadium.
How do we run functional tests on Loadium?
If you are not familiar with JMeter test in Loadium, I recommend you to read the get started with loadium section.
After clicking the New Test button, a screen like the one below will come up. If we choose Sandbox Test here, we will test Loadium without falling from our right of 15 tests 🙂
You can access the information about this screen at https://loadium.io/test/new/jmeter
Let’s upload the .jmx file to Loadium and edit the information as shown below. We start the functional test with 3 users in total. You can start your test with as many users as you want.
PS: Be careful not to overestimate the number of users in functional tests. After all, we are not load testing 🙂
Then we save our test and click the “Run Test” button.
Our test ran successfully. The GitHub homepage and login page work successfully.
On the Loadium screen, we can clearly see the outputs we want in the left menu.
Let’s look at the Response Asertion part in Loadium.
The homepage is working as we wanted, but the login page isn’t. We can see it on Loadium as below.