18 December 2008

Perfomance Testing (part 1)

Performance testing is a kind of test to determine quality from performance (speed or effectiveness) of an application or product. Performance testing is not to find a bug, but to eliminate bottlenecks.

The comparing between performance and stress testing
Performance = the limit of performance (positive testing)
Stress = unpredictable process or try to break the system (negative testing)

Example, a new product (hand phone) of NOKIA

Performance testing:
1. Accept a call for long time (a few days)
2. Accept calls from many people
3. Run many application (all application)

Stress testing:
1. During the call, shutdown the phone or turn out the battery
2. Run many program and then shutdown the phone
3. Shake the phone

How about we drop the phone on the floor during the call, is it a performance testing or stress testing?
~it is stress testing, because the test try to destroy it and find the condition after that~

What the difference with load test? Load test is a kind of test for a system which is a system is operated with the largest tasks. You can constantly increase the load on the system to find the bottlenecks. So, the load test is a part of the process of performance testing

The methodology of performance testing

According to BBST overview by Cem Kaner, the fundamental question in software testing. Once after we have a mission of our performance testing, the next level we design methodology performance testing. Remember that performance testing to determine how speed and how effectiveness a product is.

A product consists of 2 main parts, the application/functionalities and the devices. The methodology of performance testing is combination of those parts. Test the functionality which includes the specific individual tests, test the devices with as well as configuration setting of the devices it selves, and between them we increase the load testing.

The strategy of performance testing

To test the performance of a product we need a strategy to know where we want to go in term of performance testing. There might be a lot of strategy, and this is the one of them. We can start with create a test scenario, and then test metrics (collect the test result along with hits/sec or other service server resource monitors), and the last is stability (endurance) test.

Test Scenario, create a scenario and identify which is the main functionalities, the largest tasks, and the potentials a system is being down/crash (according the requirement or the fact in client). Or we can create a good scenario testing according on “Cem Kaner On Scenario Testing” (www.stqemagazine.com, September/October 2003).

Test Metrics, there could be many components involve in a functionality, such as what the network connection is used, how many hits, users, and other service server resource monitors.
Stability (endurance) test, an application is run a few hours (10-12 hours) or a few days to identify the memory bottlenecks. This test needs to be run the largest tasks at all time, such as generate report by many users for 1 day (24 hours).

Automation Testing Tool

Automation Testing Tool; is a tool to test an application/product by automatically. It is easy and very helpful for a tester, but it needs more effort to create the script.

These are the reason why automation testing tool is very helpful.
1. Every time a tester reports a defect, she can create a script with the same of procedures. If a tester forgets how to replicate the defect, she just can replay from automation testing tool
2. Retest all defects that have been closed for the new build/version (Regression testing), and cover a sample test for a new build (Smoke Test)
3. Performance testing

We can test the performance of a product with 2 ways, by using manual testing and by using automation testing tool. If we use manual testing to test the performance, it is hard to find the exactly condition of user/client. We need many users, we need many computers, and we need specific network configuration of each user. But, if we use automation testing tool, we can set how many user we need, what/how scenario is run, and which network configuration is set. Automation testing tools (not all) also provide the report/result of testing.

OpenSTA and JMeter are kinds of automation tool testing. OpenSTA is an automation testing tool for performance testing Web Application Environment. Simple words, OpenSTA helps us to test a product automatically, and provide a performance testing from component of the system under test, such as number of virtual user, and run for multiple task (concurrent or sequence). OpenSTA also provide test results to analyze the performance of an application. JMeter is an automation testing tool like OpenSTA, but it is developed under Java Environment. JMeter is designed to load test functional behavior and measure performance.

References:
1. http://www.testingeducation.org/k04/documents/BBSTOverviewPartA.ppt
2. http://www.kaner.com/pdfs/ScenarioSTQE.pdf
3. http://hosteddocs.ittoolbox.com/Questnolg22106java.pdf
4. http://devcentral.f5.com/LinkClick.aspx?link=http%3A%2F%2Fdevcentral.f5.com%2Fdownloads%2Ff5%2Fcreating-performance-test-methodology.pdf&tabid=73&mid=935
5. http://portal.opensta.org/modules.php?op=modload&name=phpWiki&file=index&pagename=SclStruts&action=diff&previous=major
6. http://jakarta.apache.org/jmeter/
7. http://agiletesting.blogspot.com/2005/02/performance-vs-load-vs-stress-testing.html
8. http://searchsoftwarequality.techtarget.com/sDefinition/0,,sid92_gci1259932,00.html
9. http://ramya-moorthy.blogspot.com/2008/02/tips-to-define-performance-test.html

How to use them;
- we just record what we test on the product/application
- set any configuration (if it is needed)
- we can replay it to find the result/report of testing.

Read more...

16 December 2008

How to get TOKEN value with OpenSTA

Let’s start to record and get the TOKEN…

1. Create New Script of HTTP
2. Open the Script Modeler of the Script
3. Set the configuration of Gateway
4. Start to record the HTTP traffic by clicking Record button
5. IE browser will be opened, configure your IE (Internet Explorer) LAN Connection
6. Type URL on Link field
7. Pass any steps or “behavior” for the web, and all steps will be recorded on Thread Group element
8. Stop the recording can be done by closing the IE browser or clicking Stop button on Script Modeler and all HTTP traffic will be recorded
9. Click Save button to save the recording
10. Find Primary Post which is posted data to server on address field and select it

11. Go to the previous address which has the respond from server. It has TOKEN value that will be used to post data to server
12. URL Detail button
13. Right click to search TOKEN value on HTML Tree tab (the right side).
14. Find TOKEN value
15. Create variable name from TOKEN value.
# Right click on TOKEN value, and click Address option.
# Type variable name, the variable name will be created on Definition section and Primary Get URL address of the Token value is sent by server

16. Go to address of Primary Post which is posted data to server, rewrite the value of TOKEN with variable name that has been created
17. Save the modification of script

Let’s start to simulate real end user…

1. Create new Tests to simulate real end user
2. Set the configuration to simulate the test
3. Run the test, Start Test button
4. You can look the result of testing Monitoring tab (while process is running), and Result tab (after the process finished)

Read more...

15 December 2008

How to get TOKEN value with JMeter

If you have never used JMeter, please refer to How to record HTTP traffic by using JMeter

Let’s start to record and get the TOKEN…

1. Add HTTP Proxy Server element on WorkBench area
2. Configure HTTP Proxy Server element, set value for Port (it is used for browser configuration) and Optional URL match string (it is used for URL that will be recorded) fields
3. Add Thread Group element on Test Plan area
4. Configure your IE (Internet Explorer) LAN Connection
5. Set the Target Controller field with your thread group name
6. Click Start button to start recording HTTP traffic
7. Type the URL (e.g. www.myweb.com) on IE (browser) Link field
8. Pass any steps or “behavior” for the web, and all steps will be recorded on Thread Group element
9. Click Stop button to end the recording
10. Add HTTP Cookie Manager element on Thread Group and set to the top of all elements
11. Filter the components, remove image/css component (optional)
12. Find the component(s) which have parameters of data that has been saved. The component may with .do format

13. Find the component with .do format on the previous before
14. Add Regular Expression Extractor element on component which has TOKEN value
# Right click on component
# Add -> Post Processors -> Regular Expression Extractor

15. Set value on Regular Expression Extractor component
# Reference Name : TOKENCreatePatient
# Regular Expression : name="org\.apache\.struts\.taglib\.html\.TOKEN".*?value="(.*?)"
# It refers to Name on component which sent TOKEN (and others data), but it is added with backslash (‘\’) before dot (‘.’)

# Template : $1$
# Match No.(0 for Random): 1
# Default Value : NOTFOUND
16. Change the value of TOKEN (or change others data to be saved) on Component which is post data to be saved, with Reference Name on Regular Expression Extractor component (e.g. ${ TOKENCreatePatient})

Let’s start to replay…

1. You can add any Listener element to get report of your test plan. For example, add View Result Tree element at the end of element
2. You can add any other element for logic controller on your test plan (we will not use this element for the example)
3. Run the test plan, Click Run menu -> Start (or Ctrl+R)
4. You can look the result of process on View Results Tree element or check on database. A new data should be added.

Read more...

11 December 2008

How to record HTTP traffic by using OpenSTA

* OpenSTA can be download from: http://downloads.sourceforge.net/opensta/ostaw32-x86-1404.msi?modtime=1192835590&big_mirror=0
* Install the OpenSTA on your computer
* Run OpenSTA Name Server
* Run OpenSTA Commander
* Reference: OpenSTA Commander help

Just a little overview:

* Collectors; creating collectors involves deciding which HOST computers or other devices to collect performance data form and the type of data to collect during a Test-Run. There are 2 kind of collectors:
1. SNMP: target any Hosts capable of running an SNMP agent or proxy SNMP agent which can include computers and other devices
2. NT Performance; collect performance data from Hosts running Windows NT or Windows 2000
* Scripts; form the content of an HTTP/S performance Test using HTTP/S load
* Tests; enable you to simulate real end-user Web activity and to collect performance data from the components of the system under test.

OpenSTA can only access a server in your Local Area Network. For servers in internet area, OpenSTA can not access them (such as www.google.com).

Let’s start to record

1. Create New Script of HTTP.
# Right click on Scripts
# Scripts -> New Script -> HTTP
# Rename it
2. Open the Script Modeler of the Script
#. Double click on the script name
3. Set the configuration of Gateway
# Open menu Options -> Gateway
# Set the Administration port and Port. Leave the Administration port with the original, and change the Port value (if it is needed, e.g. 81)
# Click OK button
4. Start to record the HTTP traffic by clicking Record button

5. IE browser will be opened, configure your IE (Internet Explorer) LAN Connection
# Open LAN Setting page: Click Tool menu -> Click Internet Option menu -> Click Connections tab menu -> Click LAN settings button
# Check Use a proxy server for your LAN (unchecked others setting)
# Address and Port fields are default filled with value of Gateway configuration
# Click Advanced button
# Fill Exception area with your computer name or with localhost

6. Type URL on Link field
7. Pass any steps or “behavior” for the web, and all steps will be recorded on Thread Group element
8. Stop the recording can be done by closing the IE browser or clicking Stop button on Script Modeler and all HTTP traffic will be recorded
9. Click Save button to save the recording

Let’s start to simulate real end user…

1. Create new Tests to simulate real end user
# Right click on Tests
# Tests -> New Test -> Tests
# Rename it
2. Set the configuration to simulate the test
# Double click on Tests name
# Drag the scripts to Task1
# It can be simulated with number of virtual user (from VUs field) and put others Task/script (parallel or series )
3. Run the test, Start Test button
4. You can look the result of testing Monitoring tab (while process is running), and Result tab (after the process finished)
# Monitor (while the process is running)
# Result (after the process finished)

Read more...

10 December 2008

How to record HTTP traffic by using JMeter

* JMeter can be download from: http://www.apache.org/dist/jakarta/jmeter/binaries/jakarta-jmeter-2.3.2.zip
* Please use “..\printable_docs\usermanual\component_reference.html” as your reference (in jakarta-jmeter-2.3.2 folder)
* To run JMeter, open .bat file: “..\bin\jmeter.bat”

Just a little overview:
* Test Plan: It is used for permanent store test elements, including settings. It will be saved on you’re your test plan file (.jmx)
* WorkBench: It is used for temporary store test elements. Any element in workbench area will be deleted after JMeter was closed. It is not recommended if you want to save test elements in this area.

JMeter can only access a server in your Local Area Network. For servers in internet area, JMeter can not access them (such as www.google.com).

Let’s start to record

1. Add HTTP Proxy Server element on WorkBench area
# Right click on WorkBench
# Add -> Non-Test Elements -> HTTP Proxy Server
2. Configure HTTP Proxy Server element, set value for Port (it is used for browser configuration) and Optional URL match string (it is used for URL that will be recorded) fields
3. Add Thread Group element on Test Plan area
# Right click on Test Plan
# Add -> Thread Group
4. Configure your IE (Internet Explorer) LAN Connection
# Open LAN Setting page: Click Tool menu -> Click Internet Option menu -> Click Connections tab menu -> Click LAN settings button
# Check Use a proxy server for your LAN (unchecked others setting)
# Fill Address field with “localhost” or your computer name
# Fill Port field with port number of HTTP Proxy Server element
5. Set the Target Controller field with your thread group name
6. Click Start button to start recording HTTP traffic
7. Type the URL (e.g. www.myweb.com) on IE (browser) Link field
8. Pass any steps or “behavior” for the web, and all steps will be recorded on Thread Group element
9. Click Stop button to end the recording
10. Add HTTP Cookie Manager element on Thread Group. This element is used to get session ID
# Right click on Thread Group
# Add -> Config Element -> HTTP Cookie Manager
# It will created on the last of elements, click and drag it to the top of elements

All components will be recorded, including file image, css, js, do, etc. Most of them are used for display only, you can remove/delete them, such as file image, css. But, please don’t remove/delete file .do and .js (or any others file that are related with request/respond data), those files are used for request and respond data

Let’s start to replay…

1. You can add any Listener element to get report of your test plan. For example, add View Result Tree element at the end of element

2. You can add any other element for logic controller on your test plan (we will not use this element for the example)
3. Run the test plan, Click Run menu -> Start (or Ctrl+R)
4. You can look the result of process on View Results Tree element

Read more...