Now if the News page has not any news we are sure that JMeter will handle this situation correctly.
Showing posts with label variables. Show all posts
Showing posts with label variables. Show all posts
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.
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.
Friday, February 12, 2010
Tip #6: How to do the Test Plan more flexible using variables and properties
JMeter's variables and properties can do your Test Plan very flexible and prevent you from frequent modifications of the Test Plan. Just add the most frequently used options as variables on the Test Plan page and specify their values using "__P" function as on the screenshot below.
As you can see Test Plan can be executed with default values and at the same time if you need to modify some options you can pass them to Test Plan through the command line without the modification of the Test Plan.
Subscribe to:
Posts (Atom)