![]() |
(405)
691-8075 I'm looking for... Site Map | FAQ |
| Home About Us Contact Us Training Consulting FREE Newsletter FREE Articles and Resources Articles and Book Reviews Podcasts Randy's Blog Conference Presentations Glossary Cheap Tools Humor QA Zone Blog Events Testimonials Books Tell a Friend Link to Us! |
How to Develop
Test Cases and Test
Scripts for Web Testing
printer-friendly
|
| Cost | Less than $20 | $20 – $29.99 | $30 – 39.99 | $40 and greater |
| Shipping Method | ||||
| Overnight | $12.00 | $16.00 | $22.00 | $27.00 |
| 2-day air | $8.00 | $8.00 | $4.00 | $0 |
| USPS | $6.00 | $6.00 | $6.00 | $0 |
The table below shows how the shipping options of an e-commerce application could be independently tested.
| ID # | Test Condition | Expected Result | Procedure | Pass/ Fail |
Defect ID # |
| 1. | Customer orders products totaling less than $20 and selects overnight shipping. | Shipping charge of $12 is applied. | 1. Customer
accesses secure ordering page.
2. Customer adds items to shopping cart totaling less than $20. 3. Customer selects "overnight shipping" as delivery option. 4. Customer confirms items in shopping cart, shipping options, and transaction total. |
||
| 2. | Customer orders products totaling less than $30 and greater than $20 and selects overnight shipping. | Shipping charge of $16 is applied. | 1. Customer
accesses secure ordering page.
2. Customer adds items to shopping cart totaling $29.99. 3. Customer selects "overnight shipping" as delivery option. 4. Customer confirms items in shopping cart, shipping options, and transaction total. |
Table 1 - Test Case Examples
Things to Notice in This Example
1. Specific test data is not embedded in the case. The test designer did not specify "1 copy of Gone With The Wind (paperback), 1 CD of Hootie and the Blowfish (sale priced at $3.99) and one poster of Aniken Skywalker. Why? Because in these test cases the items ordered only affect the observed result as a total, not individually. There’s another reason to keep specific data separate from the test case. That is to reduce the amount of maintenance to the test cases should either the test procedure or test data change. Consider this situation. We design 1,000 test cases with the only difference being the test data. Then, the web developer calls and informs you that an additional step needs to be added to the process. Normally it would not be a big deal to make a procedural change. It becomes a big deal, however, when the change is multiplied times 1,000! In keeping the data and the test case separate, we would only need to change one test case and probably not change the test data at all.
At this point you might be wondering where the test data reside and how to know the expected results. There are a variety of ways to create and maintain test data, but it could be as simple as creating a PC-based database or spreadsheet. The test data can then be obtained manually through a cross-reference, can be imported into an automated test tool, or can be entered into the application using a home-grown scripting procedure (This will be the topic of future articles.).
2. There is no sequence implied or necessary for the test cases. The important thing is that all of the conditions are tested, not necessarily the sequence. Consider the scenario where a customer selects a certain form of shipping and then decides to select a less expensive option. While it is possible to script such a scenario, the possible combinations of such scenarios can be overwhelming and not very profitable when it comes to a return on your testing investment.
3. The order of the columns is up to you. I like the format shown in the test case examples, but you might like to see the test procedure before the expected result. The important thing is to define a format and stay consistent. Consistency in items such as test cases and test scripts helps to avoid confusion during both test design and test execution.
Test Case Design Strategies for Web Applications
In the search for the best way to test your web application, you will likely have several possible approaches. It's difficult sometimes to decide which test case development approach will eventually work best, but here are some common test case strategies. The intent of this discussion is to focus on how to develop testware using a variety of approaches, many of which have been effective in other technologies and are still useful in testing web-based applications.
To arrive at the approach that works best for you, you will need to consider:
For example, if the application is very procedural, test scripts may be a primary means for designing your tests.
If you are testing the usability of an e-commerce application, you will need to consider that the eventual customers will not have the benefit of training and detailed written procedures. This would be an example of when to use test cases that give the tester a great deal of flexibility in testing.
Although there is a degree of error inherent with manual testing, well-defined test cases and test scripts give you at least some trail to follow if you ever need to repeat the test. A test script is probably the best manual vehicle to document a trail of actions, but you can also document a process with test cases ordered sequentially by using a test matrix.
The higher the degree of risk, the more rigorous the test should be. In high-risk applications, the test needs to be documented at a high level of detail. This implies the use of well-defined test cases and test scripts.
If the web application is changing rapidly and continuously, your investment in documented test cases and test scripts may prove to be overwhelming. While automated test tools can provide some relief, there are still issues in actually getting the tool integrated into your web development processes. Even with test automation, the job of test case development and defining the process to be tested is still largely a manual effort for many people.
Each of the following approaches to design web-based test cases has its strengths and weaknesses.
Test Scripts
Test scripts became popular when mainframe applications went interactive. These procedural "green screen" types of interfaces are typically very predicable in nature and the user is not given much latitude in how they can interact with the application. These procedural user interfaces gave rise to written, or manual, test scripts that told the user what to enter in each screen field, then to go to the next field, etc.
Then came the Graphical User Interface (GUI). With the advent of the GUI came the promise, and sometimes the ability, of the user to work according to their own preferences and not necessarily to a rigid procedure. The impact on test planning is that it may impossible to predict all the ways a user may perform a process while using a GUI.
Web pages tend to be visually-oriented and strive to deliver the same type of user flexibility as a client/server GUI. In addition to the web browser GUI, a typical web page may contain:
You might be asking, "But what about GUI automated test tools? Don't they use recorded test scripts as the primary means for testing?"
Yes, they do. Each script follows one path through a process, or on a smaller level, each script describes a sub-process in a modular manner. Modularity does a lot to help reduce the large numbers of test scripts required for some GUIs, but you can still only describe so many combinations of possible actions before you run out of time, people or money.
The issue is whether or not you need to predefine a sequential order of actions for testing a particular process. Since a test script describes sequence, actions and expected results, the level of interface "randomness" affects the effectiveness of test scripting. Before we decide to eliminate test scripts as a tool for testing web applications, there are some important considerations:
Test scripting can involve a variety of forms and methods. I've seen about as many test script standards as I have seen testers. To illustrate, here is a sample manual test script format. This test script format is designed to handle tests that are isolated to one page in the web application, or that span multiple pages of the application as well as other system processes over a given period of time.
Moving Into Automation
The reason I have laid the foundation in manual test cases and test scripts is because much test analysis requires getting the manual process documented first. The main point in automating tests is the ability to repeat them later. The best thing you can do to facilitate repeatable tests is to plan them to be repeatable. This implies thinking about modularity and keeping scripts free of embedded data except where absolutely essential. In other words, let's take time at the beginning and define the problem before we immediately start solving it.
Once you have the manual concepts mastered and once you have some idea of the processes and cases you want to automate, then you are ready to start thinking about automating the test. There are also other things to consider, such as naming conventions, test script management, etc.
Actually, this is where we arrive at where we started this discussion: using test cases to design a modular test. Once we can define the triggering events (test conditions) and have a way to observe the outcome (expected results), then we can design and perform a test, whether it be manual or automated.
An exciting advancement in test automation is that some of the tools are able to generate test cases automatically from the web interface. That's a step in the right direction, but there is still a need to define tests that span interfaces, such as in the case of ordering a product. It's the integration of functions that give test designers their greatest challenge.
All materials on this site copyright 1996 - 2008, Rice Consulting Services, Inc.
Rice
Consulting Services, Inc.
P.O. Box 892003
Oklahoma City, OK 73189
405-691-8075
"Leaders are made, they are not born. They are made by hard effort, which is the price which all of us must pay to achieve any goal that is worthwhile." -- Vince Lombardi
This site best
viewed with the Mozilla Firefox
browser!