Chapter7 Testing
Chapter7 Testing
System Testing
Using UML, Patterns, and Java
Overview
• Integration testing
• Big bang
• Bottom up
• Top down
• Sandwich
• Continuous
• System testing
• Functional
• Performance
• Acceptance testing
• Examples
• Summary
Page 1
Integration Testing
Page 2
Stubs and drivers
• Driver:
Driver
• A component, that calls the TestedUnit
• Controls the test cases
Tested
• Stub: Unit
• A component, the TestedUnit
depends on
• Partial implementation
Stub
• Returns fake values.
B C D
Entity
Data Currency
B Calculator
C D Layer II
Model Converter
E F G
BinaryFile XMLFile Currency Layer III
E F G
Storage Storage DataBase
Page 3
Big-Bang Approach A
B C D
Test A
Test B
E F G
Test C
Test
Test D A, B, C, D,
E, F, G
Test E
Test F
Test G
1. Test xem
Big bang Example trang chu
2. Test xem
san pham
3. Test Tim
kiem
4. Test xem chi
tiet SP
5. ……..
6. Test xem
theo chung
loai
7. Test xem
theo nha SX
8. Test mua
hang
Page 4
Bottom-up Testing Strategy
• The subsystems in the lowest layer of the call
hierarchy are tested individually
• Then the next subsystems are tested that call the
previously tested subsystems
• This is repeated until all subsystems are included
• Drivers are needed.
Bottom-up Integration A
B C D
Test E
E F G
Test B, E, F
Test F
Test C Test
A, B, C, D,
E, F, G
10
Page 5
1. Test xem
Bottom-up Example trang chu
2. Test xem
theo nha SX
3. Test xem
theo chung
loai
4. Test xem
san pham
5. Test mua
hang
6. Test Quan
ly gio hang
7. Test xem chi
tiet SP
8. ……..
11
12
Page 6
Top-down Testing Strategy
13
Top-down Integration A
B C D
E F G
Test
Test A Test A, B, C, D A, B, C, D,
E, F, G
14
Page 7
1. Test xem
Top-down Example trang chu
2. Test xem
san pham
3. Test xem
theo nha SX
4. Test xem
theo chung
loai
5. Test Quan
ly gio hang
6. Test mua
hang
7. Test xem chi
tiet SP
8. ……..
15
Cons
• Writing stubs is difficult: Stubs must allow all
possible conditions to be tested.
• Large number of stubs may be required,
especially if the lowest level of the system
contains many methods.
• Some interfaces are not tested separately.
16
Page 8
Sandwich Testing Strategy
17
B C D
Test A
E F G
Test A,B,C, D
Test E
Test
Test B, E, F A, B, C, D,
Test F E, F, G
Test D,G
Test G
18
Page 9
Pros and Cons of Sandwich Testing
19
20
Page 10
Modified Sandwich Testing Strategy
• Test in parallel:
• Middle layer with drivers and stubs
• Top layer with stubs
• Bottom layer with drivers
• Test in parallel:
• Top layer accessing middle layer (top layer
replaces drivers)
• Bottom accessed by middle layer (bottom
layer replaces stubs).
21
B C D
Test A
Test A,C
Test C E F G
Test B
Test
Test E Test B, E, F A, B, C, D,
E, F, G
Test F
Test D
Test D,G
Test G
22
Page 11
Continuous Testing
• Continuous build:
• Build from day one
• Test from day one
• Integrate from day one
System is always runnable
23
B C D
Data Currency
Calculator Layer II
Model Converter
E F G
BinaryFile XMLFile Currency Layer III
Storage Storage DataBase
+ Cells
Sheet View + File Storage
+ Addition
24
Page 12
Steps in Integration Testing
25
System Testing
• Functional Testing
• Validates functional requirements
• Performance Testing
• Validates non-functional requirements
• Acceptance Testing
• Validates clients expectations
26
Page 13
Functional Testing
27
Performance Testing
28
Page 14
Types of Performance Testing
• Stress Testing • Security testing
• Stress limits of system • Try to violate security
requirements
• Volume testing
• Test what happens if large
• Environmental test
amounts of data are handled • Test tolerances for heat,
humidity, motion
• Configuration testing
• Test the various software and
• Quality testing
hardware configurations • Test reliability, maintain-
ability & availability
• Compatibility test
• Test backward compatibility
• Recovery testing
with existing systems • Test system’s response to
presence of errors or loss
• Timing testing of data
• Evaluate response times and
time to perform a function
• Human factors testing
• Test with end users.
29
Acceptance Testing
30
Page 15
Testing has many activities
31
Test Team
Professional
Tester too familiar
Programmer with code
Analyst
Test System
User Team Designer
Configuration
Management
Specialist
32
Page 16
The 4 Testing Steps
1. Select what has to be tested 3. Develop test cases
• Analysis: Completeness of • A test case is a set of test
requirements data or situations that will
• Design: Cohesion be used to exercise the unit
(class, subsystem, system)
• Implementation: Source being tested or about the
code attribute being measured
2. Decide how the testing is 4. Create the test oracle
done • An oracle contains the
• Review or code inspection predicted results for a set of
• Proofs (Design by Contract) test cases
• Black-box, white box, • The test oracle has to be
written down before the
• Select integration testing actual testing takes place.
strategy (big bang, bottom
up, top down, sandwich)
33
34
Page 17
Examples
35
Expected
Test Case ID Test Scenario Test Steps Test Data Actual Results Pass/Fail
Results
1.Go to site
http://demo.guru9
Check Customer Userid = guru99
9.com User should Login
F01 Login with valid Password = As Expected Pass
2.Enter UserId into home page
Data pass99
3.Enter Password
4.Click Submit
1.Go to site
http://demo.guru9
Check Customer Userid = guru99 User should not
9.com
F02 Login with invalid Password = Login into home As Expected Pass
2.Enter UserId
Data glass99 page
3.Enter Password
4.Click Submit
36
Page 18
Performance test case examples
Expected
Test Case ID Test Scenario Test Steps Test Data Actual Results Pass/Fail
Results
1.Go to site
http://demo.guru9
9.com with 51th
Userid = guru99
Check time times
P02 Password = T<1ms Not As Expected Fail
response 2.Enter UserId
glass99
3.Enter Password
4.Click Submit
1.Go to site
Check web page
P04 http://demo.guru9 No data No access Access home page Fail
request (security)
9.com/home.aspx
37
Expected
Test Case ID Test Scenario Test Steps Test Data Actual Results Pass/Fail
Results
1.Open Firefox
2.Go to site
http://demo.guru9
9.com
3.Enter UserId
4.Enter Password
5.Click Submit Userid = guru99
1. Firefox: ok Firefox: Ok
A01 Check browser 6.Open IE Password = Fail
2. IE: ok IE: not ok
7.Go to site pass99
http://demo.guru9
9.com
8.Enter UserId
9.Enter Password
10.Click Submit
1.Go to site
http://demo.guru9
Userid = user 1
9.com User can not Login
A02 Check invalid user Password = As Expected Pass
2.Enter UserId into web page
glass99
3.Enter Password
4.Click Submit
38
Page 19
Test case guide
• Should
• Test Cases need to be simple and transparent
• Create Test Case with End User in Mind
• Avoid test case repetition.
• Do not Assume
• Using test case tools
• Ensure 100% Coverage
• Repeatable and self-standing
• Peer Review.
39
Scenario 1
• System testing
• 1 system includes:
• 2 web server
• 2 SQL database server
• 4 switch
• 3 LAN
• Constraints
• Redundancy (dự phòng)
• Cluster (gom cụm)
• Security (bảo mật)
• Available (sẳn sàng)
40
Page 20
Scenario 2
• System testing
• 1 system includes:
• 2 mail server
• 2 Domain controller
• 2 DHCP server
• 4 switch
• 5 LAN
• 2 Access point
• Constraints
• Redundancy (dự phòng)
• Cluster (gom cụm)
• Security (bảo mật)
• Available (sẳn sàng)
41
Summary
42
Page 21