Download presentation
Presentation is loading. Please wait.
Published byAvis Wilcox Modified over 9 years ago
1
Chapter 7 Unit Testing & Integration Testing 322 235 Software Testing By Wararat Songpan(Rungworawut),PH.D. Department of Computer Science, Faculty of Science, Khon Kaen University 1
2
Unit Testing 2 Requirements Specification Preliminary Design Preliminary Design Detailed Coding Detailed Coding Unit Testing Integration Testing Integration Testing System Testing System Testing Acceptance Testing
3
Unit testing Unit Testing is a level of the software testing process where individual units/components of a software/system are tested. The purpose is to validate that each unit of the software performs as designed. A unit is the smallest testable part of software. It usually has one or a few inputs and usually a single output. In procedural programming a unit may be an individual program, function, procedure, etc. 3
4
Unit Testing Method used for unit testing: Black Box/White Box Testing method is used for executing the unit test. Mostly Unit tests are basically written and executed by software developers to make sure that code meets its design and requirements and behaves as expected. but not always created by the developers themselves as well, whereas if a company does white box and black box testing, it can be done by Testers. 4
5
Unit Testing Environment 5 Stub Test case Black Box Method White Box Method Module is tested Driver Actual ResultsExpected Results Pass/Fail
6
Stub Complexity Stub Complexity 6 Stub A Stub A Stub B Stub B Stub C Stub C Stub D Stub D Called Stub A return Display text Called Stub B and send some parameters Called Stub C only return parameter Call Stub D and both send and return parameters
7
Example of Unit Testing C++ o Boost.Testing library o CPPUnit o CxxUnit Java o Junit NET Languages (C#, VB.NET, etc.) o Nunit Etc. 7
8
Example of Junit: 8
9
Integration Testing 9 Requirements Specification Preliminary Design Preliminary Design Detailed Coding Detailed Coding Unit Testing Integration Testing Integration Testing System Testing System Testing Acceptance Testing
10
Integration Testing Integration Testing is a level of the software testing process where individual units are combined and tested as a group. 10 M1 M2 M3 M5 M4 M6 M7
11
Integration Testing Task Integration Test Plan o Prepare o Review o Rework o Baseline Integration Test Cases/Scripts o Prepare o Review o Rework o Baseline Integration Test o Perform 11
12
Integration Testing Approach Top Down Bottom Up Big Bang Sandwich/Hybrid 12
13
Top Down Approach Top Down is an approach to Integration Testing where top level units are tested first and lower level units are tested step by step after that. This approach is taken when top down development approach is followed. Test Stubs are needed to simulate lower level units which may not be available during the initial phases. 2 Sub-top downs approach o Breadth First o Depth First 13
14
Example of Top-down 14 A BCD E H FG I JK LM
15
Example of Top-down : Breadth First A B C D E F G H I J K L M 15 A BCD E H FG I JK LM
16
Example of Top-down : Depth First A B E H C F I D G J L M K 16 A BCD E H FG I JK LM
17
Bottom Up is an approach to Integration Testing where bottom level units are tested first and upper level units step by step after that. This approach is taken when bottom up development approach is followed. Test Drivers are needed to simulate higher level units which may not be available during the initial phases. 17 Bottom Up Approach
18
Bottom-up Build 1: H E B -> create driver for testing Build 2: I F C D Build 3: L M J K G Integrate all Build 1, 2, 3 Final: A 18 A B CD E H FG I JK LM Cluster1 Cluster2 Cluster3
19
Sandwich/Hybrid is an approach to Integration Testing which is a combination of Top Down and Bottom Up approaches. 19 Sandwich/Hybrid Approach A B CD E H FG I JK LM
20
Big Bang is an approach to Integration Testing where all or most of the units are combined together and tested at one go. This approach is taken when the testing team receives the entire software in a bundle. So what is the difference between Big Bang Integration Testing and System Testing? Well, the former tests only the interactions between the units while the latter tests the entire system. 20 Big Bang Approach
21
Next Date Program 21 Date Day MonthYear
22
Top down 22 Date Day MonthYear Unit Under TestList of Stub DateDay, Month, Year DayMonth, Year MonthYear
23
Bottom Up 23 Date Day MonthYear Unit Under TestList of Stub Year0 Year+Month0 Year+Month+Day0 Year+Month+Day+Date0
24
Big Bang 24 Date Day MonthYear Unit Under TestList of Stub Date0
25
MM-Path Integration Source node is a program statement fragment at which program execution begins. Sink node is a statement fragment at which program execution terminates or ends. Module Execution Path (MEP) is a sequence of statements within a module Message is a programming language mechanism by which one unit transfers control to another unit Module to Module path(MM-path) is an interleaved sequence of module execution paths and messages 25
26
MM-Path example 26 2 1 34 5 6 1 2 3 4 1 23 4 5 MEP(A, 1) = MEP(A, 2) = MEP(A, 3) = MEP(B, 1) = MEP(B, 2) = MEP (C,1) = MEP (C, 2) = ABC A1 A2 A3 B1 B2 C1 C2
27
MM-Path Graph 27 MEP(A,2)MEP(A,1) Module A Module B MEP(B,2) MEP(B,1) Module C MEP(C,2) MEP(C,1) MEP(A,3)
28
Apply Online System Apply Online System Enrollment Exam Schedule Grading Graduated Student Student Profile Quiz Integration Testing
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.