cen 5070 -- software v&v spring 2002 testing 103 -- application forms © 2001-2002, dr. e.l....
TRANSCRIPT
CEN 5070 -- Software V&VSpring 2002
Testing 103 -- Application Forms© 2001-2002, Dr. E.L. Jones
1/2002 Testing 103 - Forms 2
What is Testing?
• Executing a software element to determine whether it meets its specification
• Executing a software element to discover defects or anomalies
• Inspecting software element code to discover defects or anomalies.
1/2002 Testing 103 - Forms 3
Form Testing -- IntroductionForm testing is a bottom-up process involving testing of visual properties, cursor movement, data entry and display, and actions triggered by buttons. Test patterns can be exploited to provide a systematic test process. With forms, certain properties can be tested immediately; others require varying degrees of system integration.
1/2002 Testing 103 - Forms 4
Examples of Units
• User-Visible software elements• Fields on forms
• Buttons on forms
• Entire forms (reports)
• Program-Internal software elements• Subprograms (procedures, functions, mains)
• Classes
• Databases
1/2002 Testing 103 - Forms 5
Elementary Units
• Form• Field
• Navigation Button
• Operation Button
• Database• Field
• Stored Procedure
• Query
• Program Code• Main
• Method
• Function
• Script
1/2002 Testing 103 - Forms 6
WHY IS A FIELD A UNIT?
• Field has properties• Data type and domain (size, value set, default)• Visual appearance (color, case, alignment)• Accesibility" Read-only, write-only, R/W
• Field has behavior• Validation -- reject if property rule violated• Messaging -- to report violation• Global status -- bad field invalidates form
1/2002 Testing 103 - Forms 7
FIELD ATTRIBUTES and BEHAVIOR
• Data type
• Length
• Format
• Domain
• Default value
• Validation rules
• Error messages
1/2002 Testing 103 - Forms 8
TESTING AN INPUT FIELDAn Error-Handling Approach
• A primary function of an input field is to validate data entered into a field, and to notify the user if an error occurs.
• Properties of the field determine error conditions and the correct response
• Input field testing ensures that only valid input is accepted, and proper error handling occurs.
1/2002 Testing 103 - Forms 9
RELATIONSHIP BETWEEN ATTRIBUTES and VALIDATION
• Validation rules perform self-checking at field, form, and/or database level
• Lotus Notes prevents some input errors• Input masking prevents formatting and data
type errors
• List boxes prevent input errors
• Certain "semantic" errors still must be checked (inconsistency)
1/2002 Testing 103 - Forms 10
BEFORE WE CONTINUE … A LOOK AHEAD
• We derive generic test case specifications
for certain types of fields
• Text boxes -- string and numeric data
• List boxes -- string and numeric data
• These become worksheet templates for
designing field test cases
1/2002 Testing 103 - Forms 11
WHERE IS THE WORK? … A LOOK AHEAD
• Developer must supply actual test cases for each test case specification• Some specs expand into multiple test cases
• Developer may derive additional generic test case specs for new field types
• Developer combines test cases into a test worksheet.
1/2002 Testing 103 - Forms 12
Deriving Generic Test Case Specs for a Text Box
a1: PREVENTED | Action
a2: Data Type Error Msg | X a3: Length Error Msg | X a4: Format Error Msg | X a5: Domain Error Msg | X a6: Field set to Default | Xa7: Truncated/padded | Xa8: Input accepted | Xa9: FIELD ERROR | X
c1: Wrong Data type | Y N N N N Condition c2: Wrong Length | - Y N N N c3: Wrong format | - - Y N N c4: Illegal value | - - - Y N c5: Default value used | N Yc6: Wrong default value | Y
1/2002 Testing 103 - Forms 13
TEXT BOX Functional TEST CASES (Generic)
Case Stimulus Expected Response
1 Wrong data type Data type error message
2 Length error message
3 Length error message, truncate
4* Format error message
5 Value error message
7 ACCEPT Default value.
6 ACCEPT value
Default value selected
Non-Default value entered
Illegal value only.
Good type, length; bad format
Good type, too long
Good type, too short
8 UNEXPECTED: FIELD Error.Wrong Default value displayed
* Expand based on format syntax
1/2002 Testing 103 - Forms 14
TEXT BOX Boundary TEST CASES (Generic)
Case Stimulus Expected Response
9 GOOD: Length = minimum ACCEPT field
101112 GOOD: value = "maximum"
GOOD: value = "minimum"
GOOD: Length = maximum
Tester sees only the Generic Test Cases, not the process followed to derive them.
ACCEPT field
ACCEPT field
ACCEPT field
1/2002 Testing 103 - Forms 15
DOSAGE CALCULATION FORM -- Specification
Field/Button Description (Specification)Patient Name
Patient Age
DosageCalculate Dosage ButtonClear Button
Name. 1-20 alpha/comma chars. Format: Last, First Middle
Computed output field. Whole number, in range 0-5.Action button. Compute dosage based on Age, Weight, and display in Dosage field.
List box: {12 and under, 13-65 (default), 65-80, over 80}.
Form button. Clear all input and output fields.
Patient Weight Weight in pounds. Whole number, in range 1-900.
Save Button Action button. Save form data to Trials Database.
GoBack Button Navigation button. Return to previous screen.
1/2002 Testing 103 - Forms 16
a) Fill in FIELD NAME
b) Create TEST DATA for each row.
c) Complete the expected result -- at minimum, issue a
message if an error occurs.
d) If a test condition does not apply for the field, delete
the row from the worksheet.
Your Turn -- Error Test Cases (Dosage Form Name Field)
1. Remove the Form Test Worksheet after Tab4
2. You will use Section A -- Field Unit Test
3. Complete the TextBox-Text Data template.
1/2002 Testing 103 - Forms 17
FORM TEST WORKSHEET – DOSAGE CALCULATION
Section A. FIELD UNIT TEST WORKSHEET
INPUT FIELD NAME: Patient Name FIELD CONTROL TYPE: Text Box DATA TYPE: Text
Test Case Description #FAILURES in Test RunCase
# Test Condition Test Case Data/Action Expected Result 1 2 3 4 5
1 Wrong data type
2 OUT: min length
3 OUT: max length
4 Bad Format
5 Illegal Value
6 Legal Value Accept
7 DEFAULT value
8 AT: min value Accept
9 AT: max value Accept
10 OUT: min value
11 OUT: max value
12 Wrong Default Observation UNEXPECTED
Total Failures for Test Run
Name Field Test WorksheetText Box (Text)
1/2002 Testing 103 - Forms 18
a) Fill in FIELD NAME
b) Create TEST DATA for each row.
c) Complete the expected result -- at minimum, issue a
message if an error occurs.
d) If a test condition does not apply for the field, delete
the row from the worksheet.
Your Turn -- Error Test Cases (Dosage Form Weight Field)
1. Use the Form Test Worksheet, Section A.
2. Complete the TextBox-Numeric Data template
1/2002 Testing 103 - Forms 19
FORM TEST WORKSHEET – DOSAGE CALCULATION
Section A. FIELD UNIT TEST WORKSHEET
INPUT FIELD NAME: Patient Weight FIELD CONTROL TYPE: Text Box DATA TYPE: Numeric (integer)
Test Case Description #FAILURES in Test RunCase
# Test Condition Test Case Data/Action Expected Result 1 2 3 4 5
1 Wrong data type
2 OUT: min length
3 OUT: max length
4 Bad Format
5 Illegal Value
6 Legal Value Accept
7 DEFAULT value
8 AT: min value Accept
9 AT: max value Accept
10 OUT: min value
11 OUT: max value
12 Wrong Default Observation UNEXPECTED
Total Failures for Test Run
Weight Field Test Worksheet Text Box (Numeric)
1/2002 Testing 103 - Forms 20
Deriving Generic Test Case Specs for a List Box
a1: PREVENTED | X X X X Action a2: Field set to Default | X a3: Input accepted | X a4: FIELD ERROR | X
Condition c1: Wrong Data type | N c2: Wrong Length | N c3: Wrong format | N c4: Invalid value | N c5: Default selected | Y N -c6: Wrong default value | N N Y
List boxes prevent these input errors.
1/2002 Testing 103 - Forms 21
LIST BOX Functional/Boundary TEST CASES (Generic)
Case Stimulus Expected Response
1 Select Default value. ACCEPT DefaultValue
2 ACCEPT ListValue_k
3 FIELD Error, no message.Wrong Default value displayed.
Select k'th value from List.
* Boundary test cases.
4 First list item ACCEPT first ListValue.
5 Last list item ACCEPT last ListValue
1/2002 Testing 103 - Forms 22
a) Fill in FIELD NAME
b) Create TEST DATA for each row.
c) Complete the expected result -- at minimum, issue a
message if an error occurs.
d) If a test condition does not apply for the field, delete
the row from the worksheet.
Your Turn -- Error Test Cases (Dosage Form Age Field)
1. Use the Form Test Worksheet, Section A.
2. Complete the ListBox template.
1/2002 Testing 103 - Forms 23
FORM TEST WORKSHEET – DOSAGE CALCULATION
Section A. FIELD UNIT TEST WORKSHEET
INPUT FIELD NAME: Patient Age FIELD CONTROL TYPE: List Box DATA TYPE: N/A
Test Case Description #FAILURES in Test RunCase
# Test Condition Test Case Data/Action Expected Result 1 2 3 4 5
1 Default value
2 First value
3 Interior value
4 Last value
5 Wrong Default Observation UNEXPECTED
Total Failures for Test Run
Age Field Test WorksheetList Box
1/2002 Testing 103 - Forms 24
Other Form-Field Attributes(verify using checklist *)
• Form-Level Test– Data source
– Data destination
– Correlated fields
– Tab/Cursor sequence *
• Field-Level Test– Required Field
– Input only access*
– Output only access*
– Input/Output access*
– Visual appearance *
1/2002 Testing 103 - Forms 25
WHEN IS VALIDATION PERFORMED?
• At the field level, immediately upon changing focus from field (e.g., client side)• Supports field build & test
• At the form level, upon clicking a button that requires the data (e.g., server side)• Deferred field test, rolled into form test.
1/2002 Testing 103 - Forms 26
GOOD NEWS!A FIELD IS REUSABLE!
• Same field used on many forms
• Most attributes are the same, so are the validation rules
• Field implementation and test are reusable
• Only form-specific attributes may change
Insight: There are reusable test patterns based on field attributes.
1/2002 Testing 103 - Forms 27
ObjectiveTesting a button is testing a function that uses form input field data, and may produce form output fields. There may be additional stimuli and responses beyond those observable from the form.
A button test is a black-box test.
1/2002 Testing 103 - Forms 28
Testing the SAVE Button
• Identify stimuli and responses• Schematic diagram
• Develop decision table• Ask questions about required behavior
• Identify conditions for certain behavior
• Develop test cases• Functional and boundary test cases
1/2002 Testing 103 - Forms 29
SAVE Button Black-Box Schematic
Stimulus Type Response Type
SAVEButton
ArgumentArgument
Inputs
GlobalsGlobals
Database
ExceptionException
ArgumentArgument
Outputs
GlobalsGlobals
Database
ExceptionException
Name, Age, Weight
Trials DB
Error Msg?
Trials DB
1/2002 Testing 103 - Forms 30
Asking the Right Questions
• Preconditions?• Trials database OPEN
and available
• Form fields are valid
• Postconditions?• Entry for patient in
Trials database
• #entries per patient?
• How are entries stored?
• Errors Detected, Messages?
• Field data not valid
• Unable to update, given field data
1/2002 Testing 103 - Forms 31
SAVE Button DECISION TABLE
c1: Trials DB open | N Y Y Y Y Y
c2: Valid Age | Y Y N Y Y
c3: Valid Weight | Y Y N Y
c4: Valid Name | Y Y N
c5: Name already in DB | N Y
a1: "DB not ready" msg | X
a2: Save | X
a3: "Duplicate entry" msg | X
a4: "Invalid Field" msg | X X X
* Impossible to have invalid Age: list box with default.* (a4) Possibly a different message for each field.
1/2002 Testing 103 - Forms 32
SAVE Button Functional Test Cases
Case Stimulus Expected Response
1
1a
3
5
6
Trials DB not ready, good fields "DB not ready" msg, no save.
Trials DB not ready, bad Name field "??" msg, no save.
DB ready, duplicate Name "Duplicate" msg, no save.
DB ready, bad Weight only. "Bad Field" msg, no save.
DB ready, bad Name only "Bad Field" msg, no save.
2 DB ready, unique Name SAVED, no msg.
4x Impossible -- drop N/A
* Multiple errors: which one takes precedence?* Infeasible test case, given list box!
1/2002 Testing 103 - Forms 33
Your Turn -- Testing the CalculateDosage Button
• Identify stimuli and responses• Schematic diagram
• Develop decision table• Ask questions about required behavior
• Identify conditions for certain behavior
• Develop test cases• Functional and boundary test cases
1/2002 Testing 103 - Forms 34
Your Turn -- CalculateDosage Button Black-Box Schematic
Stimulus Type Response Type
Calculate DosageButton
Argument
Inputs
Globals
Database
Exception
Argument
Outputs
Globals
Database
Exception
1/2002 Testing 103 - Forms 35
• Errors Detected, Messages?
• Preconditions?
• Postconditions?• patient?
Your Turn -- CalculateDosage Button -- Questions
1/2002 Testing 103 - Forms 36
Your Turn -- CalculateDosage Button Decision Table
c1: |
c2: |
a1: Dosage = calculated #pills |
a2: |
a3: |
a4: |
a5: |
NOTE: This table deals with the activation of the button in terms of visible form elements (input/output fields and error messages). Detailed rules for calculating the value were treated in Unit Testing Concepts session.
1/2002 Testing 103 - Forms 37
Your Turn -- CalculateDosage Button Test Cases
Case Test Data/Actions Expected Response
1
NOTE: These cases begin with form-level error handling for the CalculateDosage button, and contains functional test cases from the Concepts session.
2
3
4
1/2002 Testing 103 - Forms 38
Button Testing -- Summary
Testing a button is easy when the test analysis has already been performed on the underlying function. The form expands the scope of the function to include visible fields and hidden effects (e.g., database updates).
The basic question remains "what should happen, and where should I look for it?"
1/2002 Testing 103 - Forms 39
Form Testing -- Process
• Perform field tests• Perform button tests
• Form buttons*• Navigation*• Action buttons
• Perform cursor tests*• Initial position, tab sequence, position
after data entry or button activation------------------* via checklist
1/2002 Testing 103 - Forms 40
Section C. FORM BUTTON and NAVIGATION UNIT TEST CHECKLIST
CURSOR PLACEMENT and MOVEMENT
Test Case Description #FAILURES in Test RunCase
# Action Expected Result 1 2 3 4 5
1 Open form. Cursor in Patient Name field.
2 Enter valid Patient Name, then TAB. Cursor is in the Age field.
3 Accept valid Age value, then TAB. Cursor in Patient Weight field.
4 Enter valid Patient Weight, thenTAB.
Cursor on CalculateDosage button.
5 TAB from CalculateDosage button. Cursor on CLEAR button
6 TAB from CLEAR button. Cursor on SAVE button.
7 TAB from SAVE button. Cursor on CLEAR button.
Cursor on Dosage field.8 CLICK on CalculateDosage button.
Dosage field contains a value.
9 TAB from Dosage field. Cursor on SAVE button.
All fields are clear.10 CLICK on CLEAR button.
Cursor on Patient Name field.
Total Failures for Test Run
Form Test WorksheetCursor Movement & Navigation
1/2002 Testing 103 - Forms 41
Section D. VISUAL PROPERTIES CHECKLIST
#FAILURES in TestRun
Case
#
Expected Result (Observed) 1 2 3 4 51 Each link brings up the correct Web page.
2 Form/page has a unique title that serves as effective web page bookmark.
3 Each Link on form has descriptive name.
4 Background color does not interfere with text readability.
5 Form/page is free of spelling errors.
6 Form/page is free of grammatical errors.
7 Field labels and data align in tabular form.
8 Form/page has consistent look and feel as other forms/pages in system.
Total Failures for Test Run
Visual Properties Checklist
1/2002 Testing 103 - Forms 42
Form Testing -- Set Up
• Isolated Testing• Form visual attributes• Individual field testing -- validation
• Integrated Testing• Form connected to other forms for
navigation• Buttons connected to underlying code• Database connected
1/2002 Testing 103 - Forms 43
Form Testing -- Results
• Perform tests specified on Checklists and Worksheets created during design, and record results
• Form test checklist • visuals • cursor movement • navigation
• Form test worksheet • field test section*• buttons test section
------------* Generic based on field type.
1/2002 Testing 103 - Forms 44
Form Testing Worksheets
• Stored in Domino• Master template• Separate templates for each form element
• Construct Worksheet by including templates for form elements
• Preview Worksheets
1/2002 Testing 103 - Forms 45
Form Testing -- Summary
Form testing is a bottom-up process involving testing of visual properties, cursor movement, data entry and display, and actions triggered by buttons. Certain properties can be tested immediately; others require varying degrees of system integration.
1/2002 Testing 103 - Forms 46
FORM TEST WORKSHEET – DOSAGE CALCULATION
Section A. FIELD UNIT TEST WORKSHEET
INPUT FIELD NAME: Patient Name FIELD CONTROL TYPE: Text Box DATA TYPE: Text
Test Case Description #FAILURES in Test RunCase
# Test Condition Test Case Data/Action Expected Result 1 2 3 4 5
1 Wrong data type 123, Jones “Bad data type”
2 OUT: min length <null string> “Missing data”
3 OUT: max length A, Bcdefghijklmnopqrstuv “Too much data”
4 Bad Format Jordan Michael “Bad format”
5 Legal Value McEnroe, John Accept
6 AT: min value A, A Accept
7 AT: max value Z…Z[17], Z Accept
8 Wrong Default Observation UNEXPECTED
Total Failures for Test Run
Name Field Test Worksheet
1/2002 Testing 103 - Forms 47
Weight Field Test Worksheet
INPUT FIELD NAME: Patient Weight CONTROL TYPE: Text Box DATATYPE: integer
Test Case Description #FAILURES in Test RunCase
# Test Condition Test Case Data/Action Expected Result 1 2 3 4 5
1 Wrong data type 2#4 “Bad data type”
2 OUT: min length <null string> “Missing data”
3 OUT: max length 0085 “Too long”
4 Bad Format 8.5 “Bad format”
5 Illegal Value -11 “Illegal value”
6 Legal Value 185 Accept
7 AT: min value 1 Accept
8 OUT: min value 0 “Illegal value”
9 AT: max value 900 Accept
10 OUT: max value 901 “Illegal value”
11 Wrong Default Observation UNEXPECTEDTotal Failures for Test Run
1/2002 Testing 103 - Forms 48
Age Field Test WorksheetList Box
FORM TEST WORKSHEET – DOSAGE CALCULATION
Section A. FIELD UNIT TEST WORKSHEET
INPUT FIELD NAME: Patient Age FIELD CONTROL TYPE: List Box DATA TYPE: N/A
Test Case Description #FAILURES in Test RunCase
# Test Condition Test Case Data/Action Expected Result 1 2 3 4 5
1 Default value Tab thru field [13-65] accepted
2 Default value Click on default [13-65] [13-65] accepted
3 First value [12-under] [12-under] accepted
4 Interior value [13-65] [13-65] accepted
5 Last value [over 80] [over 80] accepted.
6 Wrong Default Observation UNEXPECTED
Total Failures for Test Run
1/2002 Testing 103 - Forms 49
Your Turn -- Testing the CalculateDosage Button
• Identify stimuli and responses• Schematic diagram
• Develop decision table• Ask questions about required behavior
• Identify conditions for certain behavior
• Develop test cases• Functional and boundary test cases
1/2002 Testing 103 - Forms 50
Your Turn -- CalculateDosage Button Black-Box Schematic
Stimulus Type Response Type
CALCULATEDOSAGE
Button
ArgumentArgument
Inputs
GlobalsGlobals
DatabaseDatabase
ExceptionException
ArgumentArgument
Outputs
GlobalsGlobals
DatabaseDatabase
ExceptionException
Age, Weight ErrorMsg?Dosage field
1/2002 Testing 103 - Forms 51
Your Turn -- CalculateDosage Button -- Questions
• Preconditions?• Form fields are valid
• Initial value of Dosage field (e.g., blank)?
• Postconditions?• Dosage field computed
• No other fields updated
• Cursor position
• Dosage blank if error
• Errors Detected, Messages?
• Form field data not valid
• Unable to calculate (Dosage field value: blank or ZERO?)
1/2002 Testing 103 - Forms 52
Your Turn -- CalculateDosage Button Decision Table
c1: Weight = blank | Y N N
c2: Valid Weight | - N Y*
c3: Valid Weight | - N Y*a1: Dosage = calculated #pills | X*
a2: Dosage field = blank | X X
a3: Error msg = "can't compute" | X X
a4: Cursor at Dosage field | X
a5: Cursor at Weight field | X
*NOTE: This table deals with the activation of the button in terms of visible form elements (input/output fields and error messages). Detailed rules for calculating the value were treated in Unit Testing Concepts session.
1/2002 Testing 103 - Forms 53
Your Turn -- CalculateDosage Button Test Cases
NOTE: These cases begin with form-level error handling for the CalculateDosage button, and contains functional test cases from the Concepts session.
Case Test Data/Actions Expected Response
1
2
3
4
Enter Name = "Doe, Joe"Enter Default AgeTab through BLANK Weight field
Enter Name = "Doe, Joe"Enter Default AgeEnter Weight = 925
Enter Name = "Test, Joe"Enter Age from functional test setEnter Weight from functional test set
… Remaining functional test cases …
1." Invalid Weight" message2. Dosage = blank3. Cursor at Weight
1." Missing Weight" message2. Dosage = blank3. Cursor at Weight
1. Dosage = computed value (from test case)2. Cursor at Dosage
1/2002 Testing 103 - Forms 54
Section B. ACTION BUTTON UNIT TEST WORKSHEET
ACTION BUTTON NAME: Calculate Dosage
Test Case Description #FAILURES in Test RunCase
# Test Condition Test Case Data/Action(left click
CALCULATE DOSAGE)
Expected Result 1 2 3 4 5
1 Form Error: NoWeightentered.
Enter Default AgeTab through blankWeight field.
1. Missing-Weight msg2. Dosage = blank3. Cursor at Weight
2 Form Error:Invalid Weight.
Weight = 925 1. Invalid-Weight msg2. Dosage = blank3. Cursor at Weight
3 Functional test(from decisiontable)
Name = ”Test, Joe”(throughout)Age = [12-under]Weight = 40
1. Dosage = 12. Cursor at Dosage.
4 “ “ Age = [12-under]Weight = 305
1. Dosage = 02. Cursor at Dosage.
Action Button Test Worksheet