Thursday, September 9, 2010

iMacros: Measuring Web Response Time

Introduction

It's hard to imagine a life without internet in the present age of communication. Internet is being used for just about anything ranging from getting a recipe to finding an address or researching on some topic. With the increase in the number of users on the internet, it has become imperative that the website responds to the user requests, with the latest research indicating that if a website takes more than 2-3 seconds, you start deeming it slow even though it has a lot of graphic content to render. Hence it has become a critical performance test to note the response times of your website even if it is launched on an intranet.

Measuring response times of websites can be done in the following context:

*
Checking the response times with the different system configurations of the web server on which the website is hosted.
*
Compare the response times of websites with different builds.
*
Noting the impact of adding graphical content to the website on the response times of websites.
*
Noting the impact of adding same graphical content in different formats (e.g. split images instead of a single big image).
*
Comparing the query performance for a web request exercising the database for different query implementations

This article discusses about an Add-on from firefox that helps the users to find the response times of your website. It also details on how Python scripts could be used to automate the same.
iMacros Overview

iMacros, an Add-On from Firefox, is a fairly simple record and playback tool that helps the user in the following different ways:

*
Downloading and Uploading Files from internet.
*
Automatically filling web forms
*
Performance testing of websites via Browser (Single-user)
*
Reading the web pages and importing the data to CSV files

More on iMacros here.

This article concentrates on “Web based performance testing” and details on how one of the features of the iMacros Add-on can be used to find the response time of a Website.
Tool Specifications
Add-on Version 6.6.5.0
Firefox support Firefox 3.0 - 3.6
OS Version Win 2K and above
Language English, French, German, Russian
Using iMacros

To get up and running with iMacros:

*
On the firefox browser go to Tools → Add-ons
*
Under Get Add-ons tab, search for iMacros
*
Click on 'Install Now' to install the add-on
*
Firefox browser gets restarted and you can use it by browsing to View → Slide Bar → iOpus iMacros

iMacros is now ready for use.

On the left-hand side of your home page you would see an iMacros pane as below:

imacro.jpg
Configuration

As mentioned earlier, iMacros is a record and playback tool. Let's check out the pane in detail to see how tests can be recorded and re-run.

The pane that we saw above contains three main tabs:
Play

*
Play - This option starts replaying the recorded tests for the user.
*
Pause - While the recorded tests are replayed, this option can be used to pause the test.
*
Stop - While the recorded tests are replayed, this option can be used to stop the test.
*
Repeat Macro - This option is used to reiterate the recorded tests for N number of times. Current - depicts the current iteration of the tests and Max - depicts the maximum of number of iteration a user wants to re-run the recorded test.
*
Play (Loop) - Enables the user to re-play/start the recoded tests for N iterations as mentioned under 'Repeat Macro' option.

Rec

*
Record - By clicking this user can start recording the tests.
*
Save - This option would the user to save the tests recorded. This will pop-up a Save File window that asks for 'Name' denoting the name of test and 'Create in' denoting the where the user wants to store the recorded test. It gets stored as .iim file and is also known as a Macro.
*
Load - Will open up a 'Select file to load' pop-up that suggests that the user can load the Macro (earlier recorded test) for re-run.
*
Stop - User can stop recording of the tests using this option.
*
Click Mode/Auto - This option enables how the links are recorded. Links can be recorded by:
1.
Using complete HTM tag.
2.
Using X/Y position of the link.
3.
User can choose either of them OR can go for 'Auto' mode where the Add-on uses the correct configuration for itself.
*
Save Page As - This option can be used to save the current page as .htm in the desired location.
*
Take Screenshot - Option for taking the screenshot of the current page. File is stored in a user defined location as .png.
*
Del. Cache&Cookies - This option would delete the cache and cookies of the firefox browser at the global level.
*
Wait during Play - This option enables the user to put a delay at a certain page, while re-runing the test. 'Wait Parameter' pops up and asks the user to enter the value of delay in seconds.

Edit

*
Edit Macro - It opens up the current Macro (#Current.iim) so that it could be edit.
*
Share Macro - macros can be shared by:
o
Copying as a link that can be pasted on to a browser for direct use.
o
Sending the macro using email application your system (e.g. outlook).
o
Adding it on any of the social bookmarking service. (e.g. blogger).

*
Refresh Macro List - Refreshes all the Macros under 'Favorites' tab of the iMacros pane.
*
Options: It enables the user to allow certain domains from running the shared macros. Domains not listed under this, will not be allowed to run a shared macro.
*
Help - Takes the user to the wiki page of iMacros.

Recording a Macro

A macro can be recorded by performing the following steps:

*
On the iMacros pane go to 'Rec' tab.
*
Make sure you are the web page from where you want to start the test.
*
Press the 'Record' button to start recording the test.
*
Perform all the browsing events that you need to test. iMacros would be recording the actions that you perform.
*
Click on 'Stop' to stop recording the tests.
*
'Save' can be used to save the Macros. (default path: \My Documents\iMacros\Macros).

Case Study: Measuring Response Times

Let us take an example. Here's a macro that I recorded for the case study purpose.

VERSION BUILD=6600217 RECORDER=FX
TAB T=1
URL GOTO=http://www.google.co.in/
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=NAME:q CONTENT=ChetanAppTimer
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:f ATTR=NAME:btnG&&VALUE:GoogleSearch
TAG POS=1 TYPE=A ATTR=TXT:TestingPerspective-RahulVerma'sWebsiteonSoftwareTesting

This is what the above Macros does:

*
launches “www.google.com”
*
Inputs a string “Chetan AppTimer” and clicks on the Search button
*
Clicks on the “Testing Perspective” link found by google search.

Note The above macro would work only if the above search result is found on the first page (which was the case at the time this macro was recorded)
Measuring Response Time

This script can now be tweaked to measure the response times. It can be achieved by using a simple feature in iMacros called STOPWATCH. Here's how we use it.

VERSION BUILD=6600217 RECORDER=FX
TAB T=1

SET !FILESTOPWATCH C:\logs.csv

STOPWATCH ID=Opening_Google
URL GOTO=http://www.google.co.in/
STOPWATCH ID=Opening_Google

TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=NAME:q CONTENT=ChetanAppTimer

STOPWATCH ID=Google_Search
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:f ATTR=NAME:btnG&&VALUE:GoogleSearch
STOPWATCH ID=Google_Search

STOPWATCH ID=Opening_TestingPerspective
TAG POS=1 TYPE=A ATTR=TXT:TestingPerspective-RahulVerma'sWebsiteonSoftwareTesting
STOPWATCH ID=Opening_TestingPerspective

In this Macro we have added certain statements:

*
SET !FILESTOPWATCH C:\logs.csv – This suggests that we have set a STOPWATCH on some of the operations in our recorded test and we are logging the measurements made by the add-on in “C:\logs.csv” file.
*
STOPWATCH ID=Opening_Google – This suggests that we have added a STOPWATCH on opening www.google.com. (“Opening_google” can be referred to as Transaction name as done in some commercial performance testing tools)

By enabling the STOPWATCH option for all operations in our earlier recorded script, we can easily get the response times for each operation. In the modified code, we can get the response times of:

*
Opening www.goolge.com.
*
Searching time for “Chetan AppTimer” on www.google.com.
*
Opening of www.testingperspective.com/doku.php/collabration/chetan/apptimer1.

The macro can be run in 'Play (Loop)' mode to perform N iterations.
Results and Data Analysis

We are logging the measured response times in C:\logs.csv file. Attached is the snapshot of the log file. The test was run for four times. Log file shows all the three measurements with the timestamp.

logs.jpg

After getting the measurements for four runs, the user can take an average of all the measurements under same category like “Opening Google” and get the closest approximate of the response time of www.google.com.

Similarly, the user can run the test N number of times and get the response times of websites or sub-sections of the website. Here N denotes the number of iterations a user wants to run the test for depending on the performance criterion set by the him/performance testing team.

The usual statical equivalence criteria should be employed while averaging the response times.
Application in Performance Testing

1.
As a Probing Client: A probing client is the replacement for a human tester who checks and records the response time of the website during the actual multi-user performance testing is in progress. IMacros can be a very effective way of doing this job in a consistent manner.
2.
One can build a multi-threaded solution on top of iMacros using a language of choice and later process the response time data collected to see the application behavior on a certain user load. Could be an easy way of testing small scale websites. This would be especially helpful when one is not conversant with elaborate performance testing tools or has access to tools which do not have good record/playback feature (HTTPS traffic recording is a usual lacking feature seen in free tools)

Automation Outlook

Once the tests are recorded you would want to run them with every test cycle. You can easily automate this process in either of the two ways:
Using iMacros.exe

imacros.exe is a freely available tool and can be downloaded here. You could use imacros.exe from the command line. Here are some of the commands that can be used to automate the tests:

Commands

*
Runs the macro from a desired location on the hard drive.

imacros.exe -macro \Sample.iim

*
Runs the macro in a loop with N iterations.

imacros.exe -macro \Sample.iim -loop N

*
Runs the macro with N iterations in background without actually opening up the browser instance.

imacros.exe -macro \Sample.iim -loop N -silent

*
Runs the macro with parameters.

imacros.exe -macro \Sample.iim -var_myvar

Results of the test

After running the commands on the CmdLine, you could check the results of the tests by checking on the ENV variabale %ERRORLEVEL%.

Success: %ERRORLEVEL% = 1
Failure: %ERRORLEVEL% != 1 (Value is negative)

Running the automation

*
Create a Batch file.
*
Enter in all the commands for all the macros that you want to run.
*
Double-Click and run the batch script to start running the automation.
*
Alternatively, you could also schedule it with DOS 'AT' command.

Using firefox application

Here is a simple example that shows how the macro can be run using firefox.exe.

"c:\program files\mozilla firefox\firefox.exe" http://run.imacros.net/?m=Sample.iim

Using Python Script

Here's a small Python script that can automate the tests.

def automateIMacros(macros_file_path):
import win32com.client
w=win32com.client.Dispatch("imacros")
w.iimInit("", 1)
w.iimPlay(macros_file_path)

if __name__=='__main__':
automateIMacros("")


Automation scripts for Perl, Powershell and VB could be found on iMacros wiki
Known Issues and Limitations

*
The tool itself provides response time for s single user. You would have to build a multi-user environment on top of the tool by employing a language of choice (Python/Perl/VB etc.)
*
Mainly available for Firefox, though an extension for IE is available now as well.

Cubical Decoration


UI team with Green Ganesh
Rajni performing pooja for Maestro success :)
Warli paintings done by team




Theme: Ganesha Eco Fest


This is certainly a model to create awareness in people and lead them to buy and worship eco-sensitive and green Ganesha idols for Ganesh Chaturthi 2010

Friday, September 3, 2010

Interesting facts about India.

History

India is the world's largest, oldest, continuous civilization
Although modern images of India often show poverty and lack of development, India was the richest country on earth until the time of British invasion in the early 17th Century. Christopher Columbus was attracted by India's wealth.
India never invaded any country in her last 10000 years of history.
India is the world's largest democracy.
The four religions born in India, Hinduism, Buddhism, Jainism, and Sikhism, are followed by 25% of the world's population
Chess (Shataranja or AshtaPada) was invented in India.
Varanasi, also known as Benares, was called "the ancient city" when Lord Buddha visited it in 500 B.C.E, and is the oldest, continuously inhabited city in the world today.
The art of Navigation was born in the river Sindh 6000 years ago. The very word Navigation is derived from the Sanskrit word NAVGATIH. The word navy is also derived from Sanskrit 'Nou'.
Medicine

Sushruta is the father of surgery. 2600 years ago he and health scientists of his time conducted complicated surgeries like cesareans, cataract, artificial limbs, fractures, urinary stones and even plastic surgery and brain surgery. Usage of anesthesia was well known in ancient India. Over 125 surgical equipment were used. Deep knowledge of anatomy, physiology, etiology, embryology, digestion, metabolism, genetics and immunity is also found in many texts.
Ayurveda is the earliest school of medicine known to humans. Charaka, the father of medicine consolidated Ayurveda 2500 years ago. Today Ayurveda is fast regaining its rightful place in our civilization.
Math

The value of "pi" was first calculated by Budhayana, and he explained the concept of what is known as the Pythagorean Theorem. He discovered this in the 6th century long before the European mathematician.

India invented the Number System. Zero was invented by Aryabhatta.
Bhaskaracharya calculated the time taken by the earth to orbit the sun hundreds of years before the astronomer Smart. Time taken by earth to orbit the sun: (5th century) 365.258756484 days.
Academic

The World's first university was established in Takshashila in 700 BCE. More than 10,500 students from all over the world studied more than 60 subjects. The University of Nalanda built in the 4th century BCE was one of the greatest achievements of ancient India in the field of education.
Grammar constitutes one of India's greatest contributions to Western philology. Panini, the Sanskrit grammarian, who lived between 750 and 500 BCE, was the first to compose formal grammar through his Astadhyai.

Thursday, August 26, 2010

SOFTWARE TESTER ROCK


TESRER ROCK!

Personality Traits in Software Engineering, which conducted a research survey assessing the major personality traits of software testers and developers.
k! Here’s how the scores break down:

Tester Scores

Neuroticism: Low
Extraversion: Medium
Conscientiousness: Medium
Openness To Experience: High
Cognitive Capability: High
Agreeableness: High

Tuesday, August 3, 2010

Internet Explorer 7 shortcut keys

Tabs shortcut keys:
To do the following Press this
Open links in a new tab in the background Ctrl+Click
Open links in a new tab in the foreground Ctrl+Shift+Click
Open a new tab in the foreground Ctrl+T
Switch between tabs Ctrl+Tab / Ctrl+Shift+Tab
Close current tab (or current window when there are no open tabs) Ctrl+W
Open a new tab in the foreground from the address bar Alt+Enter
Switch to the n'th tab Ctrl+n (n can be 1-8)
Switch to the last tab Ctrl+9
Close other tabs Ctrl+Alt+F4
Open quick tabs Ctrl+Q

Zoom shortcut keys:
To do the following Press this
Increase zoom (+ 10%) Ctrl+(+)
Decrease zoom (-10%) Ctrl+(-)
Original size (100% zoom)* Ctrl+0

Search shortcut keys:
To do the following Press this
Go to the Toolbar Search Box Ctrl+E
Open your search query in a new tab Alt+Enter
Bring down the search provider menu Ctrl+Down Arrow
Favorites Center shortcut keys:
To do the following Press this
Open Favorites Center to your favorites Ctrl+I
Open Favorites Center to your history Ctrl+H
Open Favorites Center to your feeds Ctrl+J
Even with all these cool keyboard hotkeys we've introduced a few helpful shortcuts for mouse users as well.
To do the following with a mouse Press this
Open a link in a background tab Middle mouse button
Close a tab Middle mouse button on the tab
Open a new tab Double click on empty tab band space
Zoom the page in/out 10% Ctrl+Mouse wheel Up/Down
Internet Explorer 5.5 and 6.0 shortcut keys:
To view and explore Web pages with shortcut keys:
To do the following Press this
Open your favorites in a folder window Shift+Click on the "Organize Favorites"
menu item
Change the text size Ctrl+Mouse wheel Up/Down
In the History or Favorites boxes, open multiple folders CTRL+click
Open the History box CTRL+H
Open the Favorites box CTRL+I
Open the Search box CTRL+E
Activate a selected link ENTER
Print the current page or active frame CTRL+P
Save the current page CTRL+S
Close the current window CTRL+W
Open a new window CTRL+N
Go to a new location CTRL+O or CTRL+L
Display Internet Explorer Help or to display context Help about an item in a dialog box F1
Toggle between full-screen and other views in the browser F11
Move forward through the items on a Web page, the Address box, or the Links box TAB
Move through the items on a Web page, the Address box, or the Links box SHIFT+TAB
Go to your Home page ALT+HOME
Go to the next page ALT+RIGHT ARROW
Go to the previous page ALT+LEFT ARROW or BACKSPACE
Display a shortcut menu for a link SHIFT+F10
Move forward between frames CTRL+TAB or F6
Move back between frames SHIFT+CTRL+TAB
Scroll toward the beginning of a document UP ARROW
Scroll toward the end of a document DOWN ARROW
Scroll toward the beginning of a
document in larger increments PAGE UP
Scroll toward the end of a document in larger increments PAGE DOWN
Move to the beginning of a document HOME
Move to the end of a document END
Find on this page CTRL+F
Refresh the current Web page F5 or CTRL+R
Refresh the current Web page, even if the time stamp for the Web version and your locally stored version are the same CTRL+F5
Stop downloading a page ESC

To Print Preview Web pages with shortcut keys:
To do the following Press this
Close Print Preview ALT+C
Display a list of zoom percentages ALT+Z
Zoom in ALT+PLUS
Zoom out ALT+MINUS
Display the last page to be printed ALT+END
Display the next page to be printed ALT+RIGHT ARROW
Type the number of the page that you
want displayed ALT+A
Display the previous page to be printed ALT+LEFT ARROW
Display the first page to be printed ALT+HOME
Change paper, headers and footers,
orientation, and margins for this page ALT+U
Set printing options and print the page ALT+P
To use the Address box with shortcut keys:
To do the following Press this
Move back through the list of AutoComplete matches DOWN ARROW
Move forward through the list of AutoComplete matches UP ARROW
Add "www." to the beginning and ".com" to the end of the text that you type in the Address box CTRL+ENTER
When in the Address box, move the cursor right to the next logical break in the address (period or slash) CTRL+RIGHT ARROW
When in the Address box, move the cursor left to the next logical break in the address (period or slash) CTRL+LEFT ARROW
Display a list of addresses that you have typed F4

To work with Favorites by using shortcut keys:
To do the following Press this
Move selected item down in the Favorites list in the Organize Favorites dialog box ALT+DOWN ARROW
Move selected item up in the Favorites list in the Organize Favorites dialog box ALT+UP ARROW
Add the current page to your favorites CTRL+D
Open the Organize Favorites dialog box CTRL+B
To edit with shortcut keys:
To do the following Press this
Remove the selected items and copy them to the Clipboard CTRL+X
Select all items on the current Web page CTRL+A
Insert the contents of the Clipboard at the selected location CTRL+V

Wednesday, July 21, 2010

What Is Requirements-Based Testing?

What Is Requirements-Based Testing?
Gary E. Mogyorodi, Bloodworth Integrated Technology, Inc.

This article provides an overview of the requirements-based testing (RBT) process. RBT is comprised of two phases: ambiguity reviews and cause-effect graphing. An ambiguity review is a technique for identifying ambiguities in functional 1 requirements to improve the quality of those requirements. Cause-effect graphing is a test-case design technique that derives the minimum number of test cases to cover 100 percent of the functional requirements. The intended audience for this article is project managers, development managers, developers, test managers, and test practitioners who are interested in understanding RBT and how it can be applied to their organization.

The requirements-based testing (RBT) process is comprised of two phases: ambiguity reviews and cause-effect graphing. An ambiguity review is a technique for identifying ambiguities in functional1 requirements to improve the quality of those requirements. Cause-effect graphing is a test-case design technique that derives the minimum number of test cases to cover 100 percent of the functional requirements.

Testing can be divided into the following seven activities:

1. Define Test Completion Criteria. The test effort has specific, quantifiable goals. Testing is completed only when the goals have been reached (e.g., testing is complete when the tests that address 100 percent functional coverage of the system all have executed successfully).
2. Design Test Cases. Logical test cases are defined by four characteristics: the initial state of the system prior to executing the test, the data, the inputs, and the expected results.
3. Build Test Cases. There are two parts needed to build test cases from logical test cases: creating the necessary data, and building the components to support testing (e.g., build the navigation to get to the portion of the program being tested).
4. Execute Tests. Execute the test-case steps against the system being tested and document the results.
5. Verify Test Results. Testers are responsible for verifying two different types of test results: Are the results as expected? Do the test cases meet the test completion criteria?
6. Verify Test Coverage. Track the amount of functional coverage achieved by the successful execution of each test.
7. Manage the Test Library. The test manager maintains the relationships between the test cases and the programs being tested. The test manager keeps track of what tests have or have not been executed, and whether the executed tests have passed or failed.

Activities one, two, and six are addressed by RBT. The remaining four activities are addressed by test management tools that track the status of test executions.

The RBT process stabilizes the application interface definition early because the requirements for the user interface become well defined and are written in an unambiguous and testable manner. This allows the use of capture/playback tools sooner in the software development life cycle.
Relative Cost to Fix an Error

The cost of fixing an error is lowest in the first phase of software development (i.e., requirements). This is because there are very few deliverables at the beginning of a project to correct if an error is found. As the project moves into subsequent phases of software development, the cost of fixing an error rises dramatically since there are more deliverables affected by the correction of each error. At the requirements phase the cost ratio to fix errors is one to one; at coding it is 10 to one; at production it is from 40 to 1,000 to one.

A study by James Martin showed that the root cause of 56 percent of all bugs identified in projects is errors introduced in the requirements phase. Of the bugs rooted in requirements, roughly half were due to poorly written, ambiguous, unclear, and incorrect requirements. The remaining half was due to requirements that were completely omitted (see Figure 1).



Figure 1: Distribution of Bugs
Figure 1: Distribution of Bugs
Why Good Requirements Are Critical

A study by the Standish Group in 2000 showed that American companies spent $84 billion for cancelled software projects. Another $192 billion was spent on software projects that significantly exceeded their time and budget estimates. The Standish Group and other studies show there are three top reasons why software projects fail:

* Requirements and specifications are incomplete.
* Requirements and specifications change too often.
* There is a lack of user input (to requirements).

The RBT process addresses each of these issues:

* It begins at the first phase of software development where the correction of errors is the least costly.
* It begins at the requirements phase where the largest portion of bugs have their root cause.
* It addresses improving the quality of requirements: Inadequate requirements often are the reason for failing projects.

A Good Test Process

The characteristics of a good test process are as follows:

* Testing must be timely. Testing begins when requirements are first drafted; it must be integrated throughout the software development life cycle. In this way, testing is not perceived as a bottleneck operation. Test early, test often.
* Testing must be effective. The approach to test-case design must have rigor to it. Testing should not rely on individual skills and experiences. Instead, it should be based on a repeatable test process that produces the same test cases for a given situation, regardless of the tester involved. The test-case design approach must provide high functional coverage of the requirements.
* Testing must be efficient. Testing activities must be heavily automated to allow them to be executed quickly. The test-case design approach should produce the minimum number of test cases to reduce the amount of time needed to execute tests, and to reduce the amount of time needed to manage the tests.
* Testing must be manageable. The test process must provide sufficient metrics to quantitatively identify the status of testing at any time. The results of the test effort must be predictable (i.e., the outcome each time a test is successfully executed must be the same).

Standard Software Development Life Cycle

There are many software development methodologies. Each has its own characteristics and approaches, but most software development methodologies share the following six aspects:

* Requirements. There is a description of what has to be delivered.
* Design. There is a description of how the requirements will be delivered.
* Code. The system is constructed from the requirements and the design.
* Test. The behavior of the code is compared to the expected behavior described by the requirements.
* Write user manuals/write training materials. Documentation is created to support the delivered system.
* International translations. Code is often executed in different countries with different languages; the initial system must be translated into the native language of the target country.

In many software development methodologies, testing does not begin until after code is constructed. If a defect is found after coding, there is a good deal of scrap and rework to correct the code, and possibly the design, test cases, and requirements as well. Defects must be tested out of the system rather than being avoided in the first place. Testing often is a bottleneck activity. See Figure 2 for a graphical representation of a standard development life cycle.



Figure 2: Standard Development Life Cycle
Figure 2: Standard Development Life Cycle
(Click on image above to show full-size version in pop-up window.)
Life Cycle With Testable Requirements

In a software development life cycle with testable requirements and integrated testing, the RBT process is integrated throughout the entire software development life cycle. As soon as requirements are complete, they are tested. As soon as the design is complete, the requirements are walked through the design to ensure that they can be met by the design. As soon as the code is constructed and reviewed, it is tested as usual. But because testing begins at the requirements phase, many defects are avoided instead of being tested out of the code.

This is a less costly and more timely approach. User manuals and training materials can be developed sooner. The entire software development life cycle is compressed. Testing is performed in parallel with development instead of all at the end, so testing is no longer a bottleneck. There are fewer surprises when the code is delivered (see Figure 3).



Figure 3: Life Cycle With Testable Requirements and Integrated Testing
Figure 3: Life Cycle With Testable Requirements and Integrated Testing
(Click on image above to show full-size version in pop-up window.)
The RBT Methodology

The RBT methodology is a 12-step process. Each of these steps is described below.

1. Validate requirements against objectives. Compare the objectives, which describe why the project is being initiated, to the requirements, which describe what is to be delivered. The objectives define the success criteria for the project. If the what does not match the why, then the objectives cannot be met, and the project will not succeed. If any of the requirements do not achieve the objectives, then they do not belong in the project scope.
2. Apply use cases against requirements. Some organizations document their requirements with use cases. A use case is a task-oriented users' view of the system. The individual requirements, taken together, must be capable of satisfying any use-case scenarios; otherwise, the requirements are incomplete.
3. Perform an initial ambiguity review. An ambiguity review is a technique for identifying and eliminating ambiguous words, phrases, and constructs. It is not a review of the content of the requirements. The ambiguity review produces a higher-quality set of requirements for review by the rest of the project team.
4. Perform domain expert reviews. The domain experts review the requirements for correctness and completeness.
5. Create cause-effect graph. The requirements are translated into a cause-effect graph, which provides the following benefits:
* It resolves any problems with aliases (i.e., using different terms for the same cause or effect).
* It clarifies the precedence rules among the requirements (i.e., what causes are required to satisfy what effects).
* It clarifies implicit information, making it explicit and understandable to all members of the project team.
* It begins the process of integration testing. The code modules eventually must integrate with each other. If the requirements that describe these modules cannot integrate, then the code modules cannot be expected to integrate. The cause-effect graph shows the integration of the causes and effects.
6. Logical consistency checks performed and test cases designed. A tool identifies any logic errors in the cause-effect graph. The output from the tool is a set of test cases that are 100 percent equivalent to the functionality in the requirements.
7. Review of test cases by requirements authors. The designed test cases are reviewed by the requirements authors. If there is a problem with a test case, the requirements associated with the test case can be corrected and the test cases redesigned.
8. Validate test cases with the users/domain experts. If there is a problem with the test case, the requirements associated with it can be corrected and the test case redesigned. The users/domain experts obtain a better understanding of what the deliverable system will be like. From a Capability Maturity Model® IntegrationSM (CMMISM) perspective, you are validating that you are building the right system.
9. Review of test cases by developers. The test cases are also reviewed by the developers. By doing so, the developers understand what they are going to be tested on, and obtain a better understanding of what they are to deliver so they can deliver for success.
10. Use test cases in design review. The test cases restate the requirements as a series of causes and effects. As a result, the test cases can be used to validate that the design is robust enough to satisfy the requirements. If the design cannot meet the requirements, then either the requirements are infeasible or the design needs rework.
11. Use test cases in code review. Each code module must deliver a portion of the requirements. The test cases can be used to validate that each code module delivers what is expected.
12. Verify code against the test cases derived from requirements. The final step is to build test cases from the logical test cases that have been designed by adding data and navigation to them, and executing them against the code to compare the actual behavior to the expected behavior. Once all of the test cases execute successfully against the code, then it can be said that 100 percent of the functionality has been verified and the code is ready to be delivered into production. From a CMMI perspective, you have verified that you are building the system right.

An Ambiguity Review

Here is a sample of a requirement written in first draft. It is not testable because it contains ambiguities.

ATMs shall send an alert to the information technology (IT) department when the ATM has been tampered with. In the event that the ATM is opened without the key and security code, the ATM will alert the IT department immediately so the appropriate action can be taken.

After performing an ambiguity review of the requirements, the following ambiguities are identified:

* What type of alert does the ATM issue to the IT department?
* What is the definition of tampered with?
* Is tampered with the same as "in the event that the ATM is opened without the key and security code?"
* What happens if the key is used and an invalid security code is entered?
* What is the alert text?
* What is the appropriate action?

The requirements are revised so that the ambiguities are eliminated. The requirements are now testable.

ATMs shall send a tamper alert to the IT department when the ATM has been tampered with, i.e., opened without the key and the valid security code.

Case 1: (1) If the service operator enters the key into the ATM, then the following message displays on the ATMconsole: "Please enter the valid security code." (2) If the service operator enters the valid security code, then the ATMopens.

Case 2: After entering the key in the ATM, if the service operator enters an incorrect security code, then (1) the following message displays on the ATM console: "Security Code invalid. Please reenter." (2) The service operator now has three tries to enter the valid security code. If a valid security code is entered in less than or equal to three tries, then the ATM is opened. Each time an invalid security code is entered, the following message is displayed on the ATM console: "Security code invalid. Please re-enter."

Case 3: If a valid security code has not been entered by the third try, then (1) the following message displays on the ATM console: "Security code invalid. The IT department will be notified." (2) The ATM alerts the IT department immediately.

Case 4: In the event that the ATM is opened without the key and the valid security code, then the ATM sends a tamper alert to the IT department immediately.

A Cause-Effect Graphing Example

Consider a check-debit function whose inputs are new balance and account type, which is either postal or counter, and whose output is one of four possible values:

* Process debit and send out letter.
* Process debit only.
* Suspend account and send out letter.
* Send out letter only.

The function has the following requirements and is testable:

* If there are sufficient funds available in the account to be in credit, or the new balance would be within the authorized overdraft limit, then process the debit.
* If the new balance is below the authorized overdraft limit, then do not process the debit, and if the account type is postal, then suspend the account.
* If a) the transaction has an account type of postal or b) the account type is counter and there are insufficient funds available in the account to be in credit, then send out letter.

The causes for the function are as follows:

* C1 - New balance is in credit.
* C2 - New balance is in overdraft, but within the authorized overdraft limit.
* C3 - Account type is postal.

The effects for the function are as follows:

* E1 - Process the debit.
* E2 - Suspend the account.
* E3 - Send out letter.

A cause-effect graph shows the relationships between the conditions (causes) and the actions (effects) in a notation similar to that used by designers of hardware logic circuits. The check-debit requirements are modeled by the cause-effect graph shown in Figure 4. C1 and C2 cannot be true at the same time.



Figure 4: Cause-Effect Graph
Figure 4: Cause-Effect Graph
(Click on image above to show full-size version in pop-up window.)

The cause-effect graph is converted into a decision table. Each column of the decision table is a rule. The table comprises two parts. In the top part, each rule is tabulated against the causes. A T indicates that the cause must be TRUE for the rule to apply and an F indicates that the condition must be FALSE for the rule to apply. In the bottom part, each rule is tabulated against the effects. A T indicates that the effect will be performed; an F indicates that the effect will not be performed; an asterisk (*) indicates that the combination of conditions is infeasible and so no effects are defined for the rule. The check-debit function has the decision table shown in Table 1.



Table 1: Decision Table
Table 1: Decision Table
(Click on image above to show full-size version in pop-up window.)

Only test cases one through five in Table 1 are required to provide 100 percent functional coverage. Rule No. 6 does not provide any new functional coverage that has not already been provided by the other five rules, so a test case is not required for rule No. 6. No test cases are generated for rule Nos. 7 and 8 because they describe infeasible conditions since C1 and C2 cannot be true at the same time. The final set of test cases with sample-data values is described in Table 2.



Table 2: Test Cases
Table 2: Test Cases
(Click on image above to show full-size version in pop-up window.)
Real-Life Problem Test Cases

With a real-life problem, there are usually far more than three inputs (causes). As an example, in one application where RBT was applied, there were 37 inputs. This allowed a maximum of 2**37, or 137,438,953,472 possible test cases. RBT resolved the problem with 22 test cases that provided 100 percent functional coverage.

Consider the following thought experiment: Put 137,438,953,450 red balls in a giant barrel. Add 22 green balls to the barrel and mix well. Turn out the lights. Pull out 22 balls. What is the probability that you have selected all 22 of the green balls? If this does not seem likely to you, try again. Return the balls and pull out 1,000 balls. What is the probability that you now have selected all 22 of the green balls? If this still does not seem likely to you, try again. Return the balls and pull out 1,000,000 balls. What is the probability that you now have selected all 22 of the green balls? This is what gut-feel testing really is.

For most complex problems it is impossible to manually derive the right combination of test cases that covers 100 percent of the functionality. The right combination of test cases is made up of individual test cases, and each covers at least one type of error that none of the other test cases covers. Taken together, the test cases cover 100 percent of the functionality. Any more test cases would be redundant because they would not catch an error that is already covered by an existing test case.

Gut-feel testing often focuses only on the normal processing flow. Another name for this is the go path. Gut-feel testing often creates too many (redundant) test cases for the go path. Gut-feel testing also often does not adequately cover all the combinations of error conditions and exceptions, i.e., the processing off the go path. As a result, gut-feel testing suffers when it comes to functional coverage.
Summary

In summary, the RBT methodology delivers maximum coverage with the minimum number of test cases. This translates into 100 percent functional coverage and approximately 70 percent to 90 percent code coverage. RBT also provides quantitative test progress metrics within the 12 steps of the RBT methodology, ensuring that testing is adequately provided and is no longer a bottleneck. Logical test cases are designed and become the basis for highly portable capture/playback test scripts.
Note

1. A functional requirement specifies what the system must be able to do in terms that are meaningful to its users. A nonfunctional requirement specifies an aspect of the system other than its capacity to do things. Examples of nonfunctional requirements include those relating to performance, reliability, serviceability, availability, usability, portability, maintainability, and extendibility.

Friday, July 16, 2010

Ideas for stress testing


  • heavy load:
    • large number of users
    • large volumes of data
    • large number of processes
    • large number of transactions
  • constrained resources
    • not enough memory, processing power, or disk space
    • not enough bandwidth
    • not enough queues (or even shallow queue depth)
    • not enough licenses
    • inability to access files, servers, or services
  • unfriendly inputs
    • invalid file types and/or data types
    • fuzz testing
    • very large (or very small) inputs
  • shared resources
    • crash or stress other applications in a shared server space or that use a shared device/service
  • timing
    • constant or steady load for long periods of time (endurance)
    • intermittent loads with long pauses in between transactions (looking for timeouts or parts of the system that go to sleep or get deprioritized with inactivity)
    • concurrency (trying to force potential race conditions, file/database locking, etc...)