Friday, November 27, 2009

Website Cookie Testing: Test cases for testing web application cookies

What is Cookie?
Cookie is small information stored in text file on user’s hard drive by web server. This information is later used by web browser to retrieve information from that machine. Generally cookie contains personalized user data or information that is used to communicate between different web pages.


Why Cookies are used?
Cookies are nothing but the user’s identity and used to track where the user navigated throughout the web site pages. The communication between web browser and web server is stateless.
For example if you are accessing domain http://www.example.com/


1.html then web browser will simply query to example.com web server for the page 1.html. Next time if you type page as http://www.example.com/2.html then new request is send to example.com web server for sending 


2.html page and web server don’t know anything about to whom the previous page 1.html served.
What if you want the previous history of this user communication with the web server? You need to maintain the user state and interaction between web browser and web server somewhere. This is where cookie comes into picture. Cookies serve the purpose of maintaining the user interactions with web server.


How cookies work?
The HTTP protocol used to exchange information files on the web is used to maintain the cookies. There are two types of HTTP protocol. Stateless HTTP and Stateful HTTP protocol. Stateless HTTP protocol does not keep any record of previously accessed web page history. While Stateful HTTP protocol do keep some history of previous web browser and web server interactions and this protocol is used by cookies to maintain the user interactions.
Whenever user visits the site or page that is using cookie, small code inside that HTML page (Generally a call to some language script to write the cookie like cookies in JAVAScript, PHP, Perl) writes a text file on users machine called cookie.
Here is one example of the code that is used to write cookie and can be placed inside any HTML page:


Set-Cookie: NAME=VALUE; expires=DATE; path=PATH; domain=DOMAIN_NAME;
When user visits the same page or domain later time this cookie is read from disk and used to identify the second visit of the same user on that domain. Expiration time is set while writing the cookie. This time is decided by the application that is going to use the cookie.
Generally two types of cookies are written on user machine.
1) Session cookies: This cookie is active till the browser that invoked the cookie is open. When we close the browser this session cookie gets deleted. Some time session of say 20 minutes can be set to expire the cookie.
2) Persistent cookies: The cookies that are written permanently on user machine and lasts for months or years.


Where cookies are stored?
When any web page application writes cookie it get saved in a text file on user hard disk drive. The path where the cookies get stored depends on the browser. Different browsers store cookie in different paths. E.g. Internet explorer store cookies on path “C:\Documents and Settings\Default User\Cookies”
Here the “Default User” can be replaced by the current user you logged in as. Like “Administrator”, or user name like “Vijay” etc.
The cookie path can be easily found by navigating through the browser options. In Mozilla Firefox browser you can even see the cookies in browser options itself. Open the Mozila browser, click on Tools->Options->Privacy and then “Show cookies” button.


How cookies are stored?
Lets take example of cookie written by rediff.com on Mozilla Firefox browser:
On Mozilla Firefox browser when you open the page rediff.com or login to your rediffmail account, a cookie will get written on your Hard disk. To view this cookie simply click on “Show cookies” button mentioned on above path. Click on Rediff.com site under this cookie list. You can see different cookies written by rediff domain with different names.


Site: Rediff.com Cookie name: RMID
Name: RMID (Name of the cookie)
Content: 1d11c8ec44bf49e0… (Encrypted content)
Domain: .rediff.com
Path: / (Any path after the domain name)
Send For: Any type of connection
Expires: Thursday, December 31, 2020 11:59:59 PM


Applications where cookies can be used:
1) To implement shopping cart:
Cookies are used for maintaining online ordering system. Cookies remember what user wants to buy. What if user adds some products in their shopping cart and if due to some reason user don’t want to buy those products this time and closes the browser window? When next time same user visits the purchase page he can see all the products he added in shopping cart in his last visit.


2) Personalized sites:
When user visits certain pages they are asked which pages they don’t want to visit or display. User options are get stored in cookie and till the user is online, those pages are not shown to him.


3) User tracking: 
To track number of unique visitors online at particular time.


4) Marketing:
Some companies use cookies to display advertisements on user machines. Cookies control these advertisements. When and which advertisement should be shown? What is the interest of the user? Which keywords he searches on the site? All these things can be maintained using cookies.


5) User sessions:
Cookies can track user sessions to particular domain using user ID and password.
Drawbacks of cookies:
1) Even writing Cookie is a great way to maintain user interaction, if user has set browser options to warn before writing any cookie or disabled the cookies completely then site containing cookie will be completely disabled and can not perform any operation resulting in loss of site traffic.
2) Too many Cookies:
If you are writing too many cookies on every page navigation and if user has turned on option to warn before writing cookie, this could turn away user from your site.
3) Security issues:
Some times users personal information is stored in cookies and if someone hack the cookie then hacker can get access to your personal information. Even corrupted cookies can be read by different domains and lead to security issues.
4) Sensitive information:
Some sites may write and store your sensitive information in cookies, which should not be allowed due to privacy concerns.
This should be enough to know what cookies are. If you want more cookie info see Cookie Central page. 
Some Major Test cases for web application cookie testing: 
The first obvious test case is to test if your application is writing cookies properly on disk. You can use the Cookie Tester application also if you don’t have any web application to test but you want to understand the cookie concept for testing.


Test cases: 
1) As a Cookie privacy policy make sure from your design documents that no personal or sensitive data is stored in the cookie.
2) If you have no option than saving sensitive data in cookie make sure data stored in cookie is stored in encrypted format.
3) Make sure that there is no overuse of cookies on your site under test. Overuse of cookies will annoy users if browser is prompting for cookies more often and this could result in loss of site traffic and eventually loss of business.
4) Disable the cookies from your browser settings: If you are using cookies on your site, your sites major functionality will not work by disabling the cookies. Then try to access the web site under test. Navigate through the site. See if appropriate messages are displayed to user like “For smooth functioning of this site make sure that cookies are enabled on your browser”. There should not be any page crash due to disabling the cookies. (Please make sure that you close all browsers, delete all previously written cookies before performing this test)
5) Accepts/Reject some cookies: The best way to check web site functionality is, not to accept all cookies. If you are writing 10 cookies in your web application then randomly accept some cookies say accept 5 and reject 5 cookies. For executing this test case you can set browser options to prompt whenever cookie is being written to disk. On this prompt window you can either accept or reject cookie. Try to access major functionality of web site. See if pages are getting crashed or data is getting corrupted.
6) Delete cookie: Allow site to write the cookies and then close all browsers and manually delete all cookies for web site under test. Access the web pages and check the behavior of the pages.
7) Corrupt the cookies: Corrupting cookie is easy. You know where cookies are stored. Manually edit the cookie in notepad and change the parameters to some vague values. Like alter the cookie content, Name of the cookie or expiry date of the cookie and see the site functionality. In some cases corrupted cookies allow to read the data inside it for any other domain. This should not happen in case of your web site cookies. Note that the cookies written by one domain say rediff.com can’t be accessed by other domain say yahoo.com unless and until the cookies are corrupted and someone trying to hack the cookie data.
8 ) Checking the deletion of cookies from your web application page: Some times cookie written by domain say rediff.com may be deleted by same domain but by different page under that domain. This is the general case if you are testing some ‘action tracking’ web portal. Action tracking or purchase tracking pixel is placed on the action web page and when any action or purchase occurs by user the cookie written on disk get deleted to avoid multiple action logging from same cookie. Check if reaching to your action or purchase page deletes the cookie properly and no more invalid actions or purchase get logged from same user.
9) Cookie Testing on Multiple browsers: This is the important case to check if your web application page is writing the cookies properly on different browsers as intended and site works properly using these cookies. You can test your web application on Major used browsers like Internet explorer (Various versions), Mozilla Firefox, Netscape, Opera etc.
10) If your web application is using cookies to maintain the logging state of any user then log in to your web application using some username and password. In many cases you can see the logged in user ID parameter directly in browser address bar. Change this parameter to different value say if previous user ID is 100 then make it 101 and press enter. The proper access message should be displayed to user and user should not be able to see other users account.
These are some Major test cases to be considered while testing website cookies. You can write multiple test cases from these test cases by performing various combinations. If you have some different application scenario, you can mention your test cases in comments below.

Testing for Internationalization

Objective
In today’s world, most of the companies are aiming to go global in order to tap the vast opportunities that exist in various global territories. To achieve this aim, there is a growing need of their applications (web and desktop) and websites to support multiple languages. Apart from developing such applications, there is a huge demand for testing these applications.
During my career, we did a lot of research for performing effective language specific testing for various applications. In this paper I am summarizing the findings which can help any novice to understand and achieve effective internationalization testing.
What is Internationalization


Internationalization (abbreviated as “i18n”) entails to design and development of an application or product that removes the barriers to localization.
It can be termed as a process or a practice that allows easy migration of a product from one language to another. The main aim of internationalization is that it helps in product localization.


What is Localization
Localization (abbreviated as “l10n”) entails to adaptation of an application or a product to support the language, culture and other requirements of a particular Locale. 
The first thing that comes to anyone’s mind when asked to perform localization is translation to a particular language. But localization is not just translation. During the course of this document you will come to know about the various things that will help you to perform effective localization testing.


Environment Compatibility
Though Unicode is becoming an increasingly adapted standard for coding, still different Operating Systems show different behaviors for this support. Windows 2000 and Windows XP provide a support for i18n, but Windows Millennium shows a bit of issues with Unicode. Other kind of issues can be seen with Mac and Unix platforms.


Know the Languages and Locales
Various different languages in the world have different characteristics. To build an application that is compatible with Western Europe languages is simpler to the one that needs to support Far eastern languages like Arabic. 


For Left-to-Right (L2R) languages, some of these languages require more screen area as compared to English. E.g. German language UI typically require almost 30% more area than that required by English. Some text translations can also raise issues like in Spanish, OK is translated to ‘Aceptar’, which will raise the issue of button size.


For Right-toLeft (R2L) languages, to perform tests for these languages, an input Method Editor (IME) is mostly preferred as they require a combination of keys for the 101 key keyboards. Among other far east languages, Japanese language uses the combination of two syllabaries with ideographs and also makes use of Latin characters as well, which further complicates the testing process.


Before starting testing identify and decide on the locales that are to be certified initially.
Identify Areas to Test and create Test Plan
It is very important to define the environments before starting the testing for internationalization. The hardware and software requirements for an application that needs to be internationalized should be narrowed down, in the starting, for getting quick results.
Apart from locale language, some of the things that should be kept in mind while testing for localization are


Date and time formats – Some regions put date in dd/mm/yyyy while some put the same in mm/dd/yyyy. The clock is preferred in some regions as in 24 hour format, while some prefer AM/PM. 


Numeric – These can be denoted differently in different countries. Like in US, 100000 is written as 100,000 while the same in India is written as 1,00,000. 
Use of currency – Currency is different for different locales. Even in English locale, currency is different for different countries like US and Canada. 


Symbols, icons and colors – Color schemas can be different for different regions. Like in the traffic lights in US, “Green” symbolizes the “Go” while in Japan the color for same is “Blue”. Same holds true for symbols and icons for regions. 


Names – Most of the English speaking countries use First Name + Middle Name + Last Name, but in some countries like China, Family Name is considered as the First Name. Similar kind of differences can be seen for different countries. 


Keyboard Usage – Apart from the 101 Key Keyboards, different countries have different key caps. Like English-language keyboard starts with “qwerty”, while a German-language keyboard starts with “qwertz”. 


Text and graphics can contain references to objects, actions or ideas which make different sense in different regions.


Varying legal requirements including the appropriate contact information for various locales 
Based on the above information, create a Test Matrix that includes platforms and versions for all the components eligible for certification. Create test cases based on the following guidelines:


Specify tests for English and non-English configurations. 


Develop non-ASCII data for any text that is used in testing. This can either be real non-English data or it can be pseudo-localized data. 


Develop tests that use non-ASCII values in path names, file names, URIs, account preferences, etc., not just in “regular” data. 


Develop tests for time or date values that specify different time zones and include cross-time zone and daylight savings. 


Create some testcases for some mixed configurations (such as Indian client to Japanese server). 


Develop tests for localizability 


Test the Life-cycle (install, uninstall, configure, etc.) 

Internationalization Testing

Definition


Internationalization is the process of designing and coding a product so it can perform properly when it is modified for use in different languages and locales. Localization (also known as L10N) refers to the process, on a properly internationalized base product, of translating messages and documentation as well as modifying other locale specific files. Assuming that there is not a separate base product for the locale, the localized files are installed at their proper location in the base product. This product is then released as a localized version of the product. 
Localizing a properly internationalized product in most cases should require no changes to the source code. 


Internationalization testing is the process, which ensures that product’s functionality is not broken and all the messages are properly externalized when used in different languages and locale. Internationalization testing is also called I18N testing, because there are 18 characters between I and N in Internationalization.


Internationalization 


In I18N testing, first step is to identify all the textual information in the system. This includes all the text present on the application’s GUI, any text/messages that application is producing including error message/warning and help/documentation etc. 


Main focus of the I18N testing is not to find functional defects, but to make sure that product is ready for the global market. As in other non functional testing it is assumed that functional testing has been completed and all the functionality related defects are identified and removed. 


I18N testing can be divided in to two parts. First, to make sure that application’s GUI or functionality will not be broken with the translated text. Second to make sure that translation of all the strings have happened properly. This activity is called Translation Verification Testing and is normally conducted by person who knows the language very well. 


To make sure that application’s functionality or GUI will not be broken after the translation a popular technique known as pseudo-translation is used. In pseudo-translation instead of translating it completely, it is translated in a pseudo manner. For example an externalized string “Bad Command” can be translated in Japanese as [JA XXXXX Bad Command XXXXXX JA]. Now if the product is launched with locale as Japanese it should show the externalized string as given above instead of “Bad Command”. There are utilities to do this job for you, to do pseudo-translation of all the externalized strings of your application. During pseudo-translation you need to make sure that you are doing it roughly according to the rule. For example, width is normally expanded up to forty percent for the pseudo-translated strings as compare to the English. 


As stated above, In I18N testing focus is not on the functionality but on the translation and locale related issues. Once all the externalized strings are pseudo-translated, you need to make sure that you have test case for every message or text element present in the system. Once it is done, same set of test cases can be executed on the properly translated build to make sure that translation is proper.


Pseudo Localisation


A convenient approach to internationalization testing is to use the technique of pseudo-localization. This technique simulates the process of localizing products, involving many things a localization center does when localizing a product. To pseudo-localize a product: 
Pseudo-translate message files by inserting a specific prefix and suffix into every message. You can also modify localizable non-message resources, such as font names and colors. Localizable non-message resources should not be translated. 
Also, other files that may be localized should be modified in some way, such as help, text, html and graphics files. Install the pseudo-translated message files, as well as all other pseudo translated or modified files, in the locale of your choice, at the proper location in the product. In certain cases, such as for Java resource bundles, you must name the files with a locale-specific suffix and install them in the same location as other locale-specific message files. 
Run the product from this locale. The messages and GUI labels should display the prefixes and suffixes you added, and not the English default messages. You should also see the behavior of the modified, localizable non-messages, and other files that were modified, like help, text, html and graphics files, will show the modified versions of these files, when run in this locale. 
This approach allows you to use the product, including its menus and other GUI objects, without needing to know another language or fully translate the message files. Many of the sections that follow take this approach. 

Software Testing Common Terms

Ad hoc Testing:
Ad hoc testing is a commonly used term for software testing performed without planning and documentation. Software Testing portal

The tests are intended to be run only once, unless a defect is discovered. Ad hoc testing is a part of exploratory testing, being the least formal of test methods. In this view, ad hoc testing has been criticized because it isn't structured, but this can also be a strength: important things can be found quickly. It is performed with improvisation, the tester seeks to find bugs with any means that seem appropriate. It contrasts to regression testing that looks for a specific issue with detailed reproduction steps, and a clear expected result. Ad hoc testing is most often used as a complement to other types of testing.

Exploratory Testing:
Exploratory testing is the tactical pursuit of software faults and defects driven by challenging assumptions. It is an approach in software testing with simultaneous learning, test design and test execution. While the software is being tested, the tester learns things that together with experience and creativity generates new good tests to run. In general, exploratory testing is a black box testing technique.

Thursday, November 26, 2009

Test Cases: A brief overview

What is a Test Case?
A test case is a set of conditions or variables and inputs that are developed for a particular goal or objective to be achieved on a certain application to judge its capabilities or features.
It might take more than one test case to determine the true functionality of the application being tested. Every requirement or objective to be achieved needs at least one test case. Some software development methodologies like Rational Unified Process (RUP) recommend creating at least two test cases for each requirement or objective; one for performing testing through positive perspective and the other through negative perspective.




Test Case Structure
A formal written test case comprises of three parts -


Information
Information consists of general information about the test case. Information has following things:
Test Case ID
Test Case Author/Creator
Test Case Version
Name of the Test Case
Purpose or brief description
Test Case Dependencies


Activity
In this area, we can include the test case pre-conditions if any. Means to executed some test cases first we need to create a condition. So we can include that in this part. Then comes environment means in which environment will the test case be able to be executed. Then in last we can include the detailed steps in order to perform the test.


Results
In this section, we can include the result related data for the test case. Means after performing the test what result did we get and what is the expected result for the test.


Designing Test Cases
Designing test cases is a time consuming job, but ultimately that helps to reduce the overall time taken to test any application. It also cuts off the time which is taken in unnecessary re-testing or debugging.


Test cases should be designed and written by someone who understands the function or technology being tested. A test case should include the following information: 


Purpose of the test
Software requirements and Hardware requirements (if any)
Specific setup or configuration requirements
Description on how to perform the test(s)
Detailed steps for performing the test
Expected results or success criteria for the test
vital for your software testing plans as a lot of bugs, ambiguities, inconsistencies and slip ups can be recovered in time as also it helps in saving your time on continuous debugging and re-testing test cases.


I hope this will give a brief idea about Test Cases.

Web Site Testing: Basic Introduction

Performance and Scalability


If you are managing Web site testing for an application that will be used by a large number of people, your number one concern will be performance testing. When several people start using the Web site at the same time, performance may degrade, database transactions might overlap, etc. Your job is to make sure that that doesn't happen.


The first thing you should ask in an interview for Web testing is "will it scale?" Now what does that mean? You want to work on a Web site that is "n-tier." That means that it has at least three layers (tiers). The layer that the user of the site sees is the GUI (Graphical User Interface) layer (also referred to as the front-end or presentation layer). Behind that, in the middle is the middle tier. This is where all the business logic happens. It's also referred to as the application layer. This is where the application servers go. Behind that is the database tier also referred to as the back-end.


In an n-tier architecture, the GUI layer should be concerned with nothing but rendering the Web page and passing transaction requests to the middle tier. No heavy duty calculations should be performed in the user's browser. It should happen on the Web site in the application layer.


The GUI layer must never, ever, ever talk to the database directly. (Side bar: I'd like to point out that I violate these rules everyday - but I'm not developing large commercial n-tier sites).


The middle tier is the heart of the application and the key to scalability. When a user makes a transaction, like filling out a form on the GUI layer, the middle tier is where the transaction is handled. The middle tier will talk to the database and do some of the transaction processing. In J2EE architecture, this layer is written using Enterprise JavaBeans. In .NET systems, this layer may be written in a language like Visual C#.


The database (back-end) can also play an important role in transaction processing. The first step in improving a Web site's performance can be to move as much of the middle tier logic as possible to stored procedures in the database.


For a Web site to scale, it must be determined how many users a middle tier server can handle. This is done through performance testing. If the middle tier is designed properly, adding another server will double the amount of users that the system can handle. If you can serve up 1 transaction per second for 500 users using 1 middle tier server, then 3 servers should be able to maintain that rate for 1500 users (500 x 3). Though realistically there will always be an acceptable amount of degradation as you add a new server.


No Web site can handle an infinite amount of users. Performance requirements have to be realistic. You may have heard in the news about Denial of Service (DoS) attacks. This is basically performance testing run amok. Hackers hijack a bunch of servers to act as agents and flood a server with transactions until they overwhelm the system. Instead of breaking the system, your job is to determine how many users it can handle before it breaks.


To test site scalability and performance, you need a testing product that can emulate x number of users hitting your site. Tools to do this range from being free, to $100,000 depending on how many "virtual users" you want to emulate. I could go on about how ridiculous it is to charge an extra $20,000 just to up an internal counter, but I'll refrain. Just be careful when shopping for tools.


Here is a list of some performance tools:


> Segue Silk Performer
> Mercury Interactive LoadRunner
> Apache JMeter


Be forewarned that some of the more expensive tools have very restrictive licensing software. I was amazed to find out that after spending a fortune on one product that only one of my employees at a time could run the editor to write tests! They expected me to spend another $10,000 to get a special meter to allow multiple editors (I declined).


You will also need to invest in at least one machine that will act as an agent, emulating hits against your test servers. I've used as many as three. Your vendor can tell you what you will need.


Staging Servers


Before you launch into a testing effort, you should find out if there is enough money in the budget to emulate the production environment. You don't want to do tests against the live site.


You need to setup a "staging" environment which emulates your production environment on a smaller scale. You will need a router, just like the one in production (or if money is really tight, something as close to it as possible), at least two Web servers and two middle tier servers and one database server. And don't forget the firewalls. If the hardware doesn't match the production environment, then testing on the staging servers won't help you find problems in the production environment. You need to work closely with the production team to make sure that your test environment emulates every bit of hardware and software in the production environment.


Your staging servers need to exist with your performance testing environment in an isolated network. Usually a patch panel is setup so you can pull one plug and isolate a rack full of servers at will. When doing performance testing, all numbers will be useless if your environment is suffering from noise not only from the corporate net, but the Internet as well.
And lock them down! Make sure developers don't have ftp, write, or PC Anywhere access to your servers. Otherwise unseen changes to your staging environment could wreak havoc on your test results.


Routers, Firewalls and SSL


Large Web sites don't have just one Web server. When you visit the site, a router will redirect you to one of many servers. The job of the router is to balance the load by trying to evenly distribute users amongst the many servers. In order for the system to work properly, all Web servers need to be exact copies of one another. So that users can get to the GUI layer servers, they need to be outside the company firewall.
Even if you are just working on a Web application destined for internal use, users may still want to use it from outside the firewall. For example, your sales force may need access from a client site to give a demo or access the application. Regardless, you must test using a firewall. Firewalls go between the GUI layer and middle tier and it's not uncommon to have a firewall between the middle tier and the back-end. You will find that an application that worked fine in an open environment collapses once a firewall is introduced. Firewalls act as choke points which could cut off or interfere with the communication between tiers.
Secure Socket Layer (SSL) is another issue that you need to deal with. If you've ever entered your credit card number online and noticed a little lock symbol in your browser, that's SSL working. Another sign is when the Web address changes from "http" to "https." Private SSL servers require a complex procedure to install a special certificate for access. Users of a commercial site should not have to go through such a procedure to create a secure connection. You need to verify that external users can access the secure layer without a problem.


Cookies and Session Management


The Web is a stateless environment. This means that a lot of data isn't stored on the client side. When you visit a site and "talk" to a Web server, it doesn't remember who you are. Though you can help it remember if you let it set a "cookie" in your browser. This is how sites remember your name, etc. When you visit the site again it asks your browser for the cookie, which may contain something like your login ID.


Cookies are good for long term memory, but for short term memory, Web applications use session management. Session management is sort of like a cookie, but it will expire after a certain amount of inactivity (like 30 minutes). Think of it like a Session ID.


As you surf a site, you may end up talking to several servers at once. Each transaction may be dished out to a different server. As you move from server to server, your session information needs to stay with you or the next server will have no idea what you are talking about. For example, when you get to the checkout server, session information will help it remember what items you ordered. For testing, you need to make sure that as a user moves through the system that session information is carried with them and hasn't expired in a reasonable amount of time.


Components and Configuration Management


When trying to setup bug tracking you may come to a horrifying conclusion. The concept of a "build number" for the overall product may not work. Web site development can be very fluid. People will update script, image, and source files through FTP or file copying without even thinking about. The concept of "builds" may even be foreign to some Web developers. You need to work with development to determine what defines a build when entering bugs. Ideally your Web site will be broken up into components that can be tested in isolation and combined and rolled out as sets.


When testing, you want to be able to certify components and component sets. For example, you may certify that Contact Form 1.1 works well with Order App 1.3, but not 1.2. Because of the fluid nature of the Web, the site probably won't be updated all at once. Developers will usually want to "drop in" a component to the live site or a client's site. That's why configuration management and certification are so important. Before Component X 2.3 is dropped in with Component Y 2.4, you need to certify that everything will still work.


If your site uses ActiveX or some other technology to install components on the browser side, you need to deal with that as well. If your application uses browser side objects, find out from your development team if you can test them directly using a language like JavaScript.


Testing Under the Hood


The GUI layer often talks to the middle tier by tossing back and forth XML files. The trend is moving towards hiding the XML files as Web Service calls. You should ask your development team if the Web Services are published in the form of an internal or external document .
If you have a programming background, you could emulate the GUI layers communication with the middle tier by automating Web Service calls. If you are comfortable with SQL, you could talk to development about unit testing stored procedures in the database layer.
Conclusion
Testing an enterprise level Web site can be an overwhelming and expensive task. Before embarking on such an effort, it's important to make sure that upper management will commit the time, money, and resources required. Given the proper budget, schedule, knowledge, and commitment from Development, you should be able to handle the task

GUI Testing: Basic Tips

Introduction


Most likely reader has already guessed that we will speak about the HCI (Human Computer Interaction) – interaction between a user (human) and computer software. We’ll discuss the aspects of this interaction by the example of Windows-applications. Also we’ll define the common principles independent from operating system and features of application, those principles that are true for the interaction between human and every information system as soon as they are based on the use psychology.


So let’s ask a question about getting the good user interface…


Only testing can prove the interface ability to work. Vlad Golovach


User interface testing: what, why and how?


The answer to the question of expediency of user interface testing is quite obvious.


Let’s imagine ourselves to be the user who decided to try our product. We start the application with a sinking heart… and… O, God! It’s absolutely impossible to understand what’s what here. All important elements are small (it’s like the developer paid crazy taxes for each superfluous square pixel used), and moreover you should work hard to find them at all. There is almost no working space left because of 5 rows of toolbar. And don’t say a word about the style unity… It’s natural that we uninstall this application, forget it like a nightmare and go to find analogues with more pleasant and clear interface.


It’s sad, isn’t it? And the only method to avoid these sad situations is interface testing. I hope that I convinced you of the importance of this type of testing.


The other good question is about what is testing of interface? From the global point of view interface testing includes a lot of things. They are usability testing with the exterior users and experts, complicated measurement system and rates; testing of all graphic elements – if they are working in the proper way, optimally situated, logically functioning, good looking; and much more other activities. We will concentrate on the graphical user interface testing – GUI testing – we’ll consider the “bricks” that it consists of and the rules and principles that help us to build beautiful palace from those “bricks”.


So when it is effective to test interface? As my own experience tells interface testing usually gets the second priority or even lower as far as the resources and time are always limited and the main attention is paid on the functional testing. Some bugs in interface can be fixed only if they are very striking.


I think that interface testing should be started when the system prototype is ready and also it should be performed every time when the new features appeared or some functionality was changed. And one should test not only that local part with changes but also the whole product to be sure of the integrity of style and to improve the interface taking into account new functions.


Vlad Golovach in his book “User interface design 2. The art of washing of elefant” (russ. Влад Головач, “Дизайн пользовательского интерфейса 2. Искусство мыть слона” [2]) recommends to use the understanding of the “good” interface each time with the corresponding context of the current application. He also recommends to ask yourself some questions, based on the quality conceptions that form the definition of the “good” interface (see Appendix 1).


Here is this useful list of questions:


    * Is it possible to accelerate the interaction of user with this interface?
    * Where are the places which can produce the human errors? Is it possible to change these fragments?
    * What in this interface doesn’t assist in teaching? What does user need to know to work successfully with this interface? Is there something in this list that interface doesn’t report itself?


If all three questions have a negative answer we pass to the following portion of questions from other conceptions of quality:
    * Do I know something about the users that makes this interface bad?
    * Does this interface satisfy all of the user’s motives that are known for me?
    * Is this interface compatible with the environment users work in?
    * Are there tasks which are processed ineffectively in interface?
    * Do I want to have this interface?


And a few words about automation. In our time automation got to many areas. It’s also used in software testing, in particular testing of interface. I can recommend the following test automation tools for interface testing: Test Complete, AUTOIT, IBM Rational Functional Tester, AutoHotKey, SilkTest, HP Mercury WinRunner.


In this article we will not deepen in automation, but consider the manual testing in detail. You can find a number of so-called checklists in the internet for verification of interface. Majority of them are either supersaturated with information (as for example Microsoft UI Guideline [3]) or contain little of useful information. I tried to choose the most basic and most important information from all of these sources and to represent it in easy-to-read form.


But before testing let’s consider some patterns of user-system interaction that will be useful to build the good interface.



Basic principles


A graphic interface deals with the questions of motivation or collecting necessary reactions from the people. All of people are different and that’s why there is no universal solutions workings always and for everybody. But there are commonly used principles – something that like most of users.


Let’s consider two basis principles of interaction between user and system.


One of such principles is the so-called Fitts’ law ( [9], [10], [11] ) formulated as early as 1954 by Paul Fitts:


The time of achieving a goal is in direct proportion to distances to the goal and inversely to the size of goal.


As applied to GUI it states that the farther object is the more time user will spend moving a pointer of mouse to it. Therefore it makes sense to shorten the distance to the most high-usage objects and make them bigger, more accessible to the user. It is possible, certainly, to draw a reverse conclusion: if we want to keep user from hasty decisions (for example, not to click some button quickly) then we make it small. As example we can mention a context menu (pop-up menu) that possesses greater availability for a user then pull-down menu as he is not required to move a mouse to call it.


Other psychological principle applied in planning of interfaces carries the name of Hick’s law ([12], [13]) and sounds as follows:


The time of reaction when choosing from a number of alternative signals depends on their number – when one should choose from n possible variants the time of choosing one of them will be in proportion to the logarithm to the base 2 of variant number plus 1, in condition that all variants are equally probable:


Time (ms) = a + b log_2(n+1)


If variants are not understood clearly then values a and b increase. If there are some skills and habits in the system usage then b is reduced.


It means that it takes time to make one or another decision; difficult decisions require more time than simple ones; and that interdependence is logarithmic. And thus, for example, the fewer items menu has the less time it’s occupies to choose one of them. One menu is better than two.


So being armed with knowledge of these principles and penetrated by the sympathy to the user we pass to the testing of interface.

Verification Checklist


We will strip GUI into bricks and define the checklist for verification of these bricks. We’ll form the list of rules based on the above mentioned principles and experience of specialists Of course it’s not a complete list – any interface needs its own thoughtfully created checklist for GUI verification, but if GUI you test comes through this list we can say that it has reliable «foundation.
Elements


Buttons


    * It should be hard for the user to click wrong button. Thus either the state of the button changes when there is a cursors on it or there are enough empty spaces between the buttons.
    * The clickable size of the buttons coincides with their visible or logical size.
    * Elements which can not be clicked or chosen should not be removed but disabled.
    * The names of the command buttons are expressed by verbs in infinitive (for example «Search», «Delete»). One can give “ОК” text to the button only if there is not enough space for the verb.
    * It is good to use icons for the often used buttons because it makes user work more comfortable and it is easier to memorize them.
    * Unity and consistency of interface require that if there are icons then they should be everywhere; if it is impossible then it’s better not to use them at all.
    * It shouldn’t be different states of the button that look identically.


Checkboxes  and radiobuttons


    * Radiobuttons should be always embedded in the scope of grouping; it is optional for checkboxes.
    * Checkboxes and radiobuttons are the buttons of postponed action – their activation shouldn't initiate any immediate action.
    * One of the radiobuttons in the group should be checked by default
    * The group of two radiobuttons can be often replaced by one checkbox, but unfortunately it not always works. Checkbox text represents only description of what will happen after its checking but it is not described what will happen if not to check it. Such construction does not work in situations when the functionality can be unclear for the users because of one or another reason.
    * Both checkboxes and radiobuttions should be placed on a vertical line, as it accelerates the search of necessary element considerably.
    * Every caption should clearly describe an effect from the choice of the proper element.
    * Captions of the parallel buttons should have approximately equal length.
    * All of captions should be positive (not to contain a negative forms)
    * It is better to place a repetitive word to the title of grouping box.
    * If a caption doesn’t go in one line then the indicator of the button (circle or square) is aligned on the first line of caption.
    * If there are more than 10 checkboxes in a group the additional one should be created to check/uncheck all.
    * If there is only a group of radiobutton in a window besides the terminal buttons (i.e. buttons starting an action) a double click on radiobutton checks it and closes a window.


Listboxes and comboboxes


Lists can be scrolling and opening, and scrolling ones can provide both unique (like the group of radiobuttons) and plural choice (checkboxes); opening ones work only as radiobuttons.


Combobox is a hybrid of list and the edit field: user can choose an existent element or enter some data himself.


Tips:


    * The list should be wide enough to show difference between elements. When it’s impossible to make the width of all elements smaller then the list width a horizontal scrollbar is not added and the text of elements is shorten (the most important fragments are determined - for example for URL it’s beginning and end of the link) and the rest is replaced with triple-dot (...) ).
    * The most probable values should be already chosen in the lists by default.
    * If a list contains more than 50 elements a filter or search mode should be proposed.
    * There are no often used short lists (less than five elements); such lists are presented as groups of radiobuttons or checkboxes.
    * The elements of list are assorted either structurally (i.e. on general attributes) or in alphabetical order or by frequency (for only lists containing less then 7 elements).
    * If there are more than 50 elements assorted in alphabetical order in the list than the first three elements are the most used elements. They are also repeated on their alphabetical places.
    * The multiline lists of plural choice are supplied with checkboxes near the each element.
    * Multiline list’s height is no less than 4 lines.
    * If there is available space then extended comboboxes are used and not single-line ones.


Editboxes


    * Edit box should contain the most probable value by default.
    * If a numeral value is entered in the edit box the value range is shown in the hint.
    * If a numeral value is entered in the edit box and it has limited range then the box is supplied with the spinner.
    * Box width is not less and, if possible, not more than the lengths of the information entered.
    * If the box is intended to input a noticeable amount of information it is multiline.
    * The multiline boxes have a maximally possible height; there is no space to make them bigger.
    * On the often used screens captions should be above the box (in order to make it easier not to read them); on the rarely used screens a caption must be on the left (in order to be noticed every time and reduce the number of errors).
    * When the screen space is worth its weight in gold a caption to an edit box can be placed into the field itself (it is necessary only to watch focus of input and clear caption when cursor is in the field).


Menu


A menu is a method of interaction between user and the application when user chooses some command from the proposed list (not giving it his own command).


    * Each menu item name starts with the capital letter.
    * All items of the first level menu activate drop down menus.
    * No more than two sublevels of menu are used.
    * If there are icons in a menu, they are used only for the most used items.
    * Items that open submenus look different from the terminal items.
    * Each object visible in an interface has specific context menu.
    * Context menu has no more than 10 items.
    * Items in context menu are assorted in the decrease of frequency of their use.
    * All items of context menus are present in other fragments of interface; there are no commands activated from context menus only.


Windows


    * There is an indicator of stretching on the stretching windows.
    * The titles of windows correspond to the names of elements that called these windows. If a window is called by an element that doesn’t have explicit name then there is the title of the screen form in the window title.
    * The type of a window (modal, modeless, with possibility of minimization/maximization) corresponds to the users’ tasks.
    * There are no menus or toolbars in dialogs.
    * The «Apply» button is used in windows-palettes only (in place of the “ОК” button).
    * There is no «Apply» button in the modal dialogs.


Icons


    * There are no icons with the similar colors and form in the groups of icons.
    * There are no icons with standard appearance but non-standard scenarios.
    * There is no text in icons.
    * In the groups icons of one value but different sizes are used for the same features and/or scenarios.


Status line


    * There are only information about the current system status and buttons (not looking like the buttons) for functions intended to the experienced users only.
    * Progress bar controls are placed in the status line. Exception: wizards, where progress bar controls can be shown inside the window.


Input forms


    * Input form has a title.
    * All input forms that are used for information collection include items «Other» and “Not applicable” or similar.
    * All required fields are marked and there is the corresponding explanation.
    * The multipage input forms have the buttons «Back» and «Next».
    * All input forms that are used for information collection contain the explanation why these data are collected and what will be and will not be performed with them.


The Structure of interface forms


    * Groups of interactive elements (form fields, menu items etc.) contain no more than seven elements.
    * The “Cancel” button is always the rightmost.
    * Multipage forms have pointing on that they are multipage; user always sees the amount of remaining screens (example: «Screen x of y»).
    * If there are a few buttons in a form, one of them is the default button. If there is only one button in the form it cannot be the default button. Buttons that are dangerous for user are not the default buttons.
    * If there is available space in a window the most frequency terminal button (i.e. button that manages a window) is bigger than others.
    * Buttons are placed in that section which they directly effects on.
    * Terminal buttons are located either below in a row or on the right in a column.
    * The buttons related to the whole block of tabs are located outside the block.
    * If a window or tab has automatically replenished content, for example, there are incoming messages in it, then the title of interface element that opens this window or tab contains the number of objects in this window and separately the number of new objects. Example: Documents (8/3).
    * Menu items and button that initiate some complex actions with additional parameters is marked with suspension points (…). Examples: element «Save As...» requires suspension points as user must choose the name of a file; element «About» does not require  suspension points as there are no independent interface elements on the opened window.
    * Captions to the interface elements are placed uniformly.


Text


    * All of interface elements have hint with the text describing the result of the use of these elements.
    * There are no slang words in an interface.
    * Not a single element is named variously in different places (an interface glossary is documented and reviewed).
    * All confirmation text includes the name of an object on which the confirmable action is performed.
    * To make text easy-to-read all long numbers are separated into the groups of 3 digits with blanks: 1 234 567.
    * Each items of the list begins with a capital letter. All items end with the final letter of the word without any punctuation mark, except for the last item that ends with a dot. Exception: if at least one item of the list contains more than one sentence then all items start with a capital letter and end with a dot.
    * There is at least one paragraph of text before an every list.
    * In tables all of columns with numbers are right justified.
    * There are no dots at the end of headings (if it is separated from the text), images captions and table names.
    * Interface element captions begin with a capital letter and end with a colon.


Interaction


    * The system makes a sound signal after it has completed some long operation (more than one minute of work).
    * If the direct manipulation is not used in the system then its interface does not have its own cursors. If direct manipulation is used, the own cursors are used only if there are no analogues in the OS.


System messages and error processing


    * The input data verification is performed in the input forms just after user has entered them; if improper information is entered the system notifies user about it at once, not waiting for a moment, when user completes the input of data in the whole form.
    * Invalid data notifications are shown near those control elements where these data were entered.
    * The text of invalid data notification does not say that error was made but informs what type and format valid data should have.
    * If the window with invalid data notification is pop-up it should not cover the input field with the error.
    * The text of reports about problems consists of three parts: a problem is briefly described in the first, the second part tells how to resolve it, and the third describes how to avoid such problems in future.
    * Status reports («Synchronization is completed successfully») are shown only in the status line.


Keyboard


    * If user presses tab key he moves between elements in the correct order.
    * Form processing starts both after clicking terminal button and pressing Enter on the last field of this form.
    * There are hotkeys combinations for the most frequently used control elements (including menus).
    * ALT-combinations are assigned to the each menu item (ALT+ underlined letters of item name).
    * ALT-combinations and hotkeys are standard.
    * If there are more than 40 hotkeys, then there is a method to change them in an interface.
    * Pressing Tab key user moves from an element to the element from the top to the bottom from the left to the right.


Visual representation


    * The direction of shadows of all controls must be identical: from below on the right.


Indication


    * Color indication is not the only one; if it is used the system is supplied with other indication too.



Layout

Talking about layout we will understand sizes, indentions, location of content inside a window or page. This aspect of interface is important not only because it makes a window or page good looking but also because it helps user to find what he needs quickly and effectively. The elements should be arranged in such way that visual hierarchy is followed.

Visual hierarchy

Visual hierarchy of window shows the interconnections and priorities of its elements. It’s hard for user to orient in interface without visual hierarchy.

Visual hierarchy is achieved by the followings aspects:

    * Focus. Layout shows user where to look in the first turn.
    * Order. The order of elements should be organized in such way that user «slides» with eyes on the surface of interface finding the elements in an order, corresponding to their usage.
    * Grouping. The logically connected elements should have clear visual relations. Elements that are not interconnected should be separated.
    * Accent. The elements of GUI should be marked out taking into account their relative importance.
    * Alignment. Layout of interface elements should be coordinated – to make it easy to look over.

It is important to remember that users don’t read - they look over only, scan content of a window or page with their eyes. And this scanning is not performed from the left to the right as reading. At first the most «attractive» elements are scanned. And, probably, an order of scan-out will be the following:

          o Interactive elements situated in the center
          o Buttons starting an action
          o Interactive elements situated in other parts of a window
          o Basic guidances
          o Additional explanations
          o Text with a warning icon
          o Title bar
          o Other static text is in the body of a window
          o Foot-notes

Accordingly to the above mentioned we have the following list of layout verification:

   1. Elements that start some operating are disposed in the left upper corner or above on a center
   2. Elements that finish some action are disposed in the right lower corner.
   3. Important information is placed on interactive elements, but not as static text in the body of a window.
   4. Important information is placed neither in the left lower corner nor at the bottom of a page or long element of interface with a scrollbar.
   5. There are no large blocks of text.

Effective usage of the screen space

The effective usage of the screen space requires the reasonable distributing of space: if there is too much available space a window looks poor and due to the above-described Fitts’ law it is hard to use it.

Screen space is used effectively if:

    * User doesn’t have to change the size of windows, panels and other elements of interface. If user first of all changes the size of the element that he are going to work with it means that the size of element is wrong.
    * Information which must be seen for implementation of some action should not be cut.
    * Windows and other elements of interface have a size allowing to avoid the unnecessary page changing.
    * There should not be large empty areas.

The combination of cut information or scrollbars with a generous amount of blank space is the main indicator of inefficient elements layout.

Element sizes

         Element sizes and distance between them are also important. There is a list of recommendations for sizes and distances between elements carefully given by Microsoft [14]
 
Conclusion

Let’s give some resume for this article. So, in this work we
    * learned more about «good» interface
    * discussed questions that should be asked each time during the testing of interface
    * learned some common principles of human perception coming from psychology
    * talked about conceptions of interface quality
    * considered an interface by elements and defined what and why is good and correct for each element.
    * considered the correct layout of interface elements.

Certainly one should remember that the fact that an interface satisfies the mentioned checklists is not sufficient but only necessary condition to get “good” interface. There is always something more than the standard, some salt of the current application. And of the tasks of QA specialist is to find and understand this specialty and bring it to the users.


References

   1. Vlad V. Golovach. Design of the User interface (rus) - 
http://uibook2.usethics.ru/
   2. 
http://msdn.microsoft.com/en-us/library/ms997506.aspx
   3. 
http://usethics.ru/blog/lib/software_checklist/
   4. Alan Kuper about an interface. Bases of planning of co-operation.Ñèìâîë-Ïëþñ, 2009.
   5. 
http://usethics.ru/
   6. 
http://www.edsd.ru/rus/test.shtml
   7. 
http://usabilist.com.ua/
   8. 
http://fww.few.vu.nl/hci/interactive/fitts/
   9. 
http://www.romver.ru/services/services.php?razdel=718
  10. 
http://msdn.microsoft.com/ru-ru/library/bb545459(en-us).aspx#Fitts
  11. 
http://psi.webzone.ru/st/033400.htm
  12. 
http://usabilist.com.ua/2009/02/zakon-xika/
  13. 
http://msdn.microsoft.com/ru-ru/library/aa511279(en-us).aspx#controlsizing

A
ppendix. Conceptions of quality for user interface

It’s very hard to give the general definition of «good» interface, but it is possible to compose it from some attributes from different conceptions of interface quality, taking into account the specific of testable application.

Here is the approximate list of things making an interface good (it is taken from [2]).

 So, an interface can be considered as good one if it:

    * is «comfortable», «simple» and «usable»

In this case it is necessary to define clearly what these concepts mean for the future users of this software product.

    * possesses the high ergonometric indices

For example we can take so-called Shneiderman’s indexes: speed of user work, number of human errors, subjective satisfaction, speed of learning to operate with an interface, extent of these skills remaining when user doesn’t use the product.

    * is optimized for its users 

Here we mean User Сentered Design, UCD, the main idea of it is the following: if we study our audience and optimize an interface for it then we can create really good interface.

    * Is optimized for the user tasks

Now it’s about Task Centered Design, TCD. In obedience to this conception interface is good if it user tasks are executed effectively in it. This method is broader than UCD and includes it in a non-obvious form: really, how will we choose the best solution for the users if we don’t know everything about these users?

    * Is optimized for the user motives

Goal Centered Design, GCD states that users do something for satisfaction of the personal necessities, otherwise — motives; when we identify these necessities and compare them to the user tasks we gain the better understanding of what should be done.

    * possesses the high usability indices

Usability concept is more integral than above-mentioned. The most commonly used definition of usability (from the standard ISO 9241-11) states:

Usability is the extent to which a product can be used by specified users to achieve specified goals with efficiency, effectiveness and satisfaction in and specified context of use.

Here I also want to mention the definition produced by Vlad V. Golovach [1]:

Usability is an index of amount of errors, speed of interaction with a product, speed of gaining skills of interaction and subjective satisfaction of certain users of product achieving certain goals/reasons in the certain context of  use.

    * Is adequate to the user activity

There is conception of Activity Theory originated from the works of Russian psychologists Vygotskiy, Rubinstein and Leont'ev.

    * Is commercially successful. 

Other measure of interface quality is commercial success. Usually product should be sold and its interface should help sales. If it does than it is a good interface; if it doesn’t — it’s bad. This means that users like this interface.