Continue
发表于:2007-06-30来源:作者:点击数:
标签:
User Interface - How the user interacts with the product is very import ant , in part because in some cases the user will be someone very familiar with WebSite browsing and not necessarily a testing expert. The design we implemented takes
User Interface - How the user interacts with the product is very import
ant, in part because in some cases the user will be someone very familiar with WebSite browsing and not necessarily a testing expert. The design we implemented takes this reality into a
clearcase/" target="_blank" >ccount.
·
"C" Scripting. We use interpreted "C" language as the control language because the syntax is well known, the language is fully expressive of most of the needed logic, and because it interfaces well with other products.
·
Files Interface. We implemented a set of dialogs to capture critical information and made each of them recordable in a text file. The dialogs are associated with files that are kept in parallel with each browser invocation:
o
Keysave File: This is the file that is being created the file is shown line by line during script recording as the user moves around the candidate WebSite.
o
Timing File: Results of timings are shown and saved in this file.
o
Messages File: Any error messages encountered are delivered to this file. For example, if a file can@#t be downloaded within the user-specified maximum time an error message is issued and the playback continues. (This helps preserve the utility of tests that are partially unsuccessful.)
o
Event File: This file contains a complete log of recording and playback activities that are useful primarily to debug a test recording session or to better understand what actually went on during playback.
·
Operational Features.Based on prior experience, the user interface for CAPBAK/Web had to provide for several kinds of capabilities a
lready known to be critical for a testing system. Many of these are critically important for automated testing because they assure an optimal combination of test script reliability and robustness.
o
Script Capture/Replay: We had to be able to capture a user@#s actual behavior online, and be able to create scripts by hand.
- Object Mode: The recording and playback had to support pure-Object Mode operation. This was achieved by using internal information structures in a way that lets the scripts (either recorded or constructed) refer to objects that are meaningful in the browser context.
- [Adjustable] True-Time Mode: We assured realistic behavior of the product by providing for recording of user-delays and for efficient handling of delays by incorporating a continuously variable "playback delay multiplier" that can be set by the user.
- Playback Synchronization: For tests to be robust there must be a built-in mode that assures synchronization so that Web-dependent delays don@#t interfere with proper WebSite checking. CAPBAK/Web does this using a proprietary playback synchronization method that waits for download completion (except if a specified maximum wait time is exceeded).
- Timer Capability: To make accurate on-line performance checks we built in a 1 millisecond resolution timer that could be read and reset from the playback script.
- Validate Selected Text Capability: A key need for WebSite content checking, as described above, is the ability to capture an element of text from an image so that it can be compared with a baseline value. This feature was implemented by digging into the browser data structures in a novel way (see below for an illustration). The user highlights a selected passage of the web page and clicks on the "Validate Selected Text" menu item.
Figure 1. Illustration of CAPBAK/Web Validate Selected Text Feature.
What results is a recorded line that includes the ASCII text of what was selected, plus some other information that locates the text fragment in the page. During playback if the same text is
not found at the same location an error message is generated.
- Multiple-playback: We confirmed that multiple playback was possible by running separate copies of the browser in parallel. This solved the problem of how to multiply a single test session into a number of test sessions to simulate multiple users each acting realistically.
·
Test Wizards - In most cases manual scripting is too laborious to use and making a recording to achieve a certain result is equally unacceptable. We built in several
test wizards that mechanize some of the most common script-writing chores.
o
Link Wizard: This wizard creates a script based on the current Web page that visits every link in the page. Scripts created this way are the basis for "link checking" test suites that confirm the presence (but not necessarily the content) of URLs.
- FORM Wizard: For E-Commerce testing which involves FORMS we included in the system a FORM Wizard that generates a script that:
- Initializes the form.
- Presses each pushbutton by name.
- Presses each radio button by name.
- Types a pre-set script fragment into each text field.
- Presses SUBMIT.
Here is a sample of the output of this wizard, applied to our standard test page:
void name() { /* Produced by CAPBAK/Web [IE] Ver. 1.5 Form Wizard */ /* (c) Copyright 1999 by Software Research, Inc. */ WT_InitLink("http://www.testworks.com/Products/Web/CAPBAK/example1/"); WT_SubmitForm(FORM:0:12, "RESET FORM"); WT_SelectOneRadio(FORM:0:0, "now", "TRUE"); WT_SelectOneRadio(FORM:0:1, "next", "TRUE"); WT_SelectOneRadio(FORM:0:2, "look", "TRUE"); WT_SelectOneRadio(FORM:0:3, "no", "TRUE"); WT_SelectCheckBox(FORM:0:4, "concerned", "TRUE"); WT_SelectCheckBox(FORM:0:5, "info", "TRUE"); WT_SelectCheckBox(FORM:0:6, "evaluate", "TRUE"); WT_SelectCheckBox(FORM:0:7, "send", "TRUE"); WT_FormTextInput(FORM:0:8, "TestWorks"); WT_FormTextInput(FORM:0:9, "TestWorks"); WT_FormTextInput(FORM:0:10, "TestWorks"); WT_FormTextInput(FORM:0:11, "TestWorks"); WT_SubmitForm(FORM:0:13, "SUBMIT FORM"); } |
Figure 2. Sample of Output of FORM Test Wizard.
The idea is that this script can be processed automatically to produce the result of varying combinations of pushing buttons. As is clear, the wizard will have pushed all buttons, but only the last-applied one in a set of radio buttons will be left in the TRUE state.
- Text Wizard: For detailed content validation this wizard yields up a script that includes in confirmation of the entire text of the candidate page. This script is used to confirm that the content of a page has not changed (in effect, the entire text content of the subject is recorded in the script).
Example Uses
Early applications of the CAPBAK/Web system have been very effective in producing experiments and collecting data that is very useful for WebSite checking. While we expect CAPBAK/Web to be the main engine for a range of WebSite quality control and testing activities, we@#ve chosen two of the most typical and most important applications to illustrate how CAPBAK/Web can be used.
·
Performance Testing Illustration - To illustrate how CAPBAK/Web measures timing we have built a set of
Public Portal Performance Profile TestSuites that have these features:
o
Top 20 Web Portals: We selected 20 commonly available WebSites on which to measure response times. These are called the "P4" suites.
- User Recording: We recorded one user@#s excursion through these suites and saved that keysave file (playback script).
- User Recording: We played back the scripts on a 56 kbps modem so that we had a realistic comparison of how long it would take to make this very-full visit to our selected 20 portals.
- P4 Timings: We measured the elapsed time it took for this script to execute at various times during the day. The results from one typical day@#s executions showed a playback time range of from 457 secs. to 758 secs (i.e. from -19% of the average to +36% of the average playback time).
- Second Layer Added: We added to the base script a set of links to each page referenced on the same set of 20 WebSites. This yielded the P4+ suite that visits some 1573 separate pages, or around 78 per WebSite. The testsuite takes around 20,764 secs (~5 Hrs 45 mins) to execute, or an average of 1038 secs per WebSite.
- Lessons Learned: It is relatively easy to configure a sophisticated test script that visits many links in a realistic way, and provides realistic user-perceived timing data.
·
E-Commerce Illustration - This example shows a typical E-Commerce product ordering situation. The script automatically places an order and uses the Validate Selected Text sequence to confirm that the order was processed correctly. In a real-world example this is the equivalent of (i) selecting an item for the shopping basket, (ii) ordering it, and (iii) examining the confirmation page@#s order code to assure that the transaction was successful. (The final validation step of confirming that the ordered item was actually delivered to a specific address is not part of what CAPBAK/Web can do.)
o
Typical Order Form: We based this script on a typical order form that collects customer information including, for example, a code number (a credit card number).
- Type-In with Code Number: Starting with the FORM Wizard generated script, we modify it to include only the parts we want, and include the code number 8889999 (See ).
- Response File: Once the playback presses the SUBMIT button the WebServer response page shows up displaying the response to the code number. We use the Validate Selected Text (See ) to capture the response number text.
- Error Message Generated: If the Cgi-Bin scripts make a mistake this will be caught during playback because the expected exact text 8889999 will not be present, it will be something else.
- Completed TestScript: Here is the complete testscript for CAPBAK/Web that illustrates this sequence of activities.
void name() { /* Recording by CAPBAK/Web [IE] Ver. 1.5 (c) Copyright 1999 by Software Research, Inc. */ WT_InitLink("http://www.soft.com/Products/Web/CAPBAK/example1/example1broken.html"); WT_SelectOneRadio(FORM:1:0, "buying-now", "TRUE"); WT_SelectOneRadio(FORM:1:1, "next-month", "FALSE"); WT_SelectOneRadio(FORM:1:2, "just-looking", "FALSE"); WT_SelectOneRadio(FORM:1:3, "no-interest", "FALSE"); WT_SelectOneRadio(FORM:1:4, "Yes", "TRUE"); WT_SelectOneRadio(FORM:1:5, "Yes", "TRUE"); WT_SelectOneRadio(FORM:1:6, "Yes", "TRUE"); WT_SelectOneRadio(FORM:1:7, "Yes", "TRUE"); WT_FormTextInput(FORM:1:8, "Mr. Software"); WT_FormTextInput(FORM:1:9, "415-550-3020"); WT_FormTextInput(FORM:1:10, "info@soft.com"); WT_FormTextInput(FORM:1:11, "8889999"); WT_SubmitForm(FORM:1:13, "SUBMIT FORM"); WT_Wait(3425); WT_ValidateText(12, 143, "88899999"); } |
- Figure 3. Script for E-Commerce Test Loop.
- Lessons Learned: This examples illustrates how it is possible to automatically validate a website using CAPBAK/Web by detecting when an artificial order is mis-processed.
Summary
All of these needs and requirements impose constraints on the test automation tools used to confirm the quality and reliability of a WebSite. The CAPBAK/Web approach offers some significant benefits and technical advantages when dealing with complicated WebSites. Better, more reliable WebSites should be the result.
Resources
This article is based on many sources and relies in part on a prior White Paper .
A more complete version of this paper can be found at
You can learn more about the CAPBAK/WEB system by taking a .
There is a detailed description of the
原文转自:http://www.ltesting.net