Now if the News page has not any news we are sure that JMeter will handle this situation correctly.
Tuesday, October 26, 2010
Tip #13: Checking for empty variable using IF controller
Sometimes you need to add HTTP samplers with dynamic URL or with dynamic part of the URL which are stored in some variable after HTTP sampler post-processing.
But if Regular Expression Extractor will not find any matching string result variable will be set to default value (empty value in our case). We should test this variable for emptyness before we will use it.
Now if the News page has not any news we are sure that JMeter will handle this situation correctly.
Now if the News page has not any news we are sure that JMeter will handle this situation correctly.
Wednesday, June 2, 2010
Tip #12: How to add HTTP Request sampler with dynamic URL
If you need to add HTTP Request sampler with dynamic URL that can be different each time from testing to testing you must use one of the Post-Processors offered by JMeter. I usually use Regular Expression Extractor for this purposes.
So, let's imaging that you have "Popular News" web page which contains the links to "News Story" web pages that contains the full texts of news and you want to write a test which will include both "News" page and random "News Story" page.
For this you must include "News" page HTTP Request sampler inside Simple Controller with a Regular Expression Extractor to store random "News Story" page URL to a variable:
Then use the variable with the stored random "News Story" page URL in "News Story" HTTP sampler:
So, let's imaging that you have "Popular News" web page which contains the links to "News Story" web pages that contains the full texts of news and you want to write a test which will include both "News" page and random "News Story" page.
For this you must include "News" page HTTP Request sampler inside Simple Controller with a Regular Expression Extractor to store random "News Story" page URL to a variable:
Then use the variable with the stored random "News Story" page URL in "News Story" HTTP sampler:
Tuesday, March 23, 2010
Tip #11: Template for JMeter's recording proxy
If you often need to use JMeter's recording proxy you can save your time by using templates for HTTP request filtering. Just add HTTP Proxy Server element to Workbench, than add regular expressions for URLs of your site like www\.example\.com.* to "URL Patterns to Include" list, add regular expressions for exclusion of some static HTTP requests like .*\.css$ to "URL Patterns to Exclude" list and save this template using "Save Selection As..." item of HTTP Proxy Server's context menu.
Next time you can just open this file in JMeter and you will have ready for work recording proxy.
Next time you can just open this file in JMeter and you will have ready for work recording proxy.
Sunday, March 14, 2010
Tip #10: How to add authentication to Test Plan
Most of websites have user communities and allow users to do some actions like posting comments if they are authenticated on this website. Often the performance of a web page can be quite different depending on that fact if this page was visited by authenticated user or anonymous one. So we need to test theese pages by both anonymous users and authenticated ones. How to add authentication is described below.
The steps are mostly similar to the steps of adding website search but have some small differencies.
First record HTTP/HTTPS requests going to authentication page with login/password form in your browser and submitting this form. You will get Authentication Form Page and Authentication Process transactions. Then you need to replace login and password parameters values by some variables like ${USER} and ${PASSWORD} on Authentication Process HTTP request settings.
After that you need to prepare the text file where each line contains username and password separated by some delimiter character, e.g., comma and add new CSV Data Set Config element like below.
And now all next HTTP requests will be performed by authenticated users.
The steps are mostly similar to the steps of adding website search but have some small differencies.
First record HTTP/HTTPS requests going to authentication page with login/password form in your browser and submitting this form. You will get Authentication Form Page and Authentication Process transactions. Then you need to replace login and password parameters values by some variables like ${USER} and ${PASSWORD} on Authentication Process HTTP request settings.
After that you need to prepare the text file where each line contains username and password separated by some delimiter character, e.g., comma and add new CSV Data Set Config element like below.
And now all next HTTP requests will be performed by authenticated users.
Thursday, March 4, 2010
Tip #9: Testing website search
Almost every modern website has search feature and it must be carefully and thoroughly tested. You will know from this post how to do it using JMeter.
First record necessary HTTP requests (including search page and search results page) using JMeter's recording proxy and group them into separate transactions.
Then go to HTTP Request sampler which corresponds to search results page and replace the keyword (which you used during recording) with some variable name, e.g., ${KEYWORD}.
Then prepare the list of keywords you want to use for search testing, save them to the text file and add CSV Data Set Config element to Thread Group. Specify the name of just created file and the variable name which will contain your keywords from file, e.g., KEYWORD (see above).
Now you are ready to test the search on your website.
First record necessary HTTP requests (including search page and search results page) using JMeter's recording proxy and group them into separate transactions.
Then go to HTTP Request sampler which corresponds to search results page and replace the keyword (which you used during recording) with some variable name, e.g., ${KEYWORD}.
Then prepare the list of keywords you want to use for search testing, save them to the text file and add CSV Data Set Config element to Thread Group. Specify the name of just created file and the variable name which will contain your keywords from file, e.g., KEYWORD (see above).
Now you are ready to test the search on your website.
Subscribe to:
Posts (Atom)









