- 
Unit Testing vs. Integration Testing 单元测试与集成测试
Unit testing: Test an Individual Unit or Basic Component of the System before Integration.  单元测试:在集成之前测试系统的单个单元或基本组件。
E.g., Test a Square Root (SQRT) Function   例如,测试一个平方根(SQRT)函数 
Integration: Testing of Collections of Dependent Components. 集成:测试依赖组件的集合。
E.g., Test the integration of SQRT in a Quadratic Equation Solver function.  例如,测试四次方程解算器函数中的SQRT的集成。
- 
Decomposition – Based Testing Strategies 基于分解的测试策略
- 
- Top-Down
- Bottom-up
- Sandwich
- Big-Bang
 
- 
Top-Down integration testing
- 
- Strategy
 
  - Focuses on testing the top layer of the application first 专注于首先测试应用程序的顶层
                 The main, or the root of the call tree   调用树的主或根
  - General process is to gradually add more subsystems that are referenced/required by the already tested subsystems when testing the application 
         一般过程是在测试应用程序时逐步添加更多已测试的子系统引用/要求的子系统
  - Do this until all subsystems are incorporated into the test   执行此操作,直到所有子系统都合并到测试中
  - Breadth first or depth first approaches are possible    广度优先或深度优先的方法都是可能的
- 
- 
Stubs are needed to do the testing
 
- 
   —— A program or a method that simulates the input-output functionality of a missing subsystem by answering to the decomposition sequence of the calling subsystem and returning back simulated data  通过响应调用子系统的分解序列并返回模拟数据来模拟缺失子系统的输入-输出功能的程序或方法
   —— Must Return a Valid Response.   必须返回有效的响应
      May Do Nothing Useful.    可能无用
      May Always Do the Same Thing.    可能总是做同样的事情
      May Return Random Values.    可能返回随机值
      May Handle Specific Cases.    可以处理特定情况
            
- 
Bottom-up integration testing- Strategy
- Focuses on testing the units at the lowest levels first 首先专注于测试最低级别的单元 
 - Gradually includes the subsystems that reference/require the previously tested subsystems 逐步包括引用/需要先前测试的子系统的子系统
 - Do until all subsystems are included in the testing 直到所有子系统都包含在测试中
- Drivers are needed to do the testing:
 
- Strategy
A driver is a specialized routine that passes test cases to a subsystem 驱动程序是将测试用例传递到子系统的专用例程
    
- 
sandwich integration testing
Combines top-down strategy with bottom-up strategy  将自上而下策略与自下而上的策略相结合
    Doing big bang integration on a subtree  在子树上进行大爆炸积分
             
- 
Big bang integration testing
All units are compiled together  所有单元一起编译
All units are tested together  所有单元一起进行测试
- 
Integration testing: work numbers- For top-down integration 用于自上而下的集成
 
Number of nodes – 1 = number of edges (corresponds to number of stubs are needed) 节点数 – 1 = 边数(对应于所需的存根数)
- 
- For bottom-up integration 用于自下而上的集成
 
Number of nodes – number of leaves = number of internal nodes (corresponds to number of drivers are needed) 节点数 – 叶数 = 内部节点数(对应于所需的驱动程序数)
- 
Integration testing methods集成测试方法
- Decomposition-based integration 基于分解的集成
Basis: Functional Decomposition Tree 基础:功能分解树
- Call Graph – based integration 基于调用图的集成
Basis: unit calling graph (refined functional decomposition tree) 基础:单元调用图(细化函数分解树)
- Path-based integration 基于路径的集成
Basis: MM-PATHS 基础:MM-PATHS
                   
- Source node: A program statement fragment at which program execution begins or resumes. Ex.源节点:程序开始或恢复执行的程序语句片段.
the first statement in a program. 程序中的第一个语句。
nodes immediately after nodes that transfer control to other units. 节点紧跟在将控制权转移到其他单元的节点之后。
- Sink node: A statement fragment at which program execution terminates. Ex. 接收器节点:程序执行终止的语句片段。
the final statement in a program  程序中的最终语句
nodes representing statements that transfer control to other units  表示将控制权转移到其他单元的语句的节点
- 
Moudle execution path (MEP)模块执行路径- A sequence of statements within a module that
 
-Begins with a source node  从源节点开始
-Ends with a sink node  以接收器节点结尾
-With no intervening sink nodes  没有干预接收器节点
- 
MM-path graph
- Given a set of units, their MM-path graph is the directed graph in which:  给定一组单位,它们的 MM 路径图是有向图,其中:
Nodes are module execution paths (MEPs)  节点是模块执行路径 (MEP)
Edges correspond to messages and message returns from one unit to another  边对应于消息,消息从一个单元返回到另一个单元
- The definition is with respect to a set of units.  It directly supports composition of units and composition-based integration testing.  
该定义是关于一组单位的。 它直接支持单元组合和基于组合的集成测试。
- 
Example:
             

MM-paths:
       
- 
System Testing
Objective: Assess whether the application does what it is supposed to do  目标:评估应用程序是否执行了它应该执行的操作
Basis: Behavioral/functional specification  基础:行为/功能规范
Test case:  Thread of system-level behavior  测试用例:系统级行为的线程
- 
Atomic System Function
            
- 原子系统函数 (ASF):在系统级别可观察到的端口输入和输出事件操作。
—— 它以端口输入事件开头,
—— 遍历一个或多个 MM 路径,
—— 并以端口输出事件终止。
ASF 代表集成和系统测试之间的链接
—— 它们是集成测试期间要测试的最大项目
—— 它们是系统测试的最小项目。
- 
Example


 
- 
Thread Definitions 线程定义
- Source ASF: an ASF that appears as a source node in the ASF graph of a system, 源 ASF:在系统的 ASF 图中显示为源节点的 ASF,
- Sink ASF: is an ASF that appears as sink node in the ASF graph. 接收器 ASF:是在 ASF 图中显示为接收器节点的 ASF。
- System thread: a path from a source ASF to a sink ASF in the ASF graph of a system. 系统线程:从源 ASF 到系统 ASF 图中接收器 ASF 的路径。
- Thread graph: (for a system defined in terms of system threads) is directed graph in which nodes are system threads and edges represent sequential execution of individual threads.
线程图:(对于根据系统线程定义的系统)是有向图,其中节点是系统线程,边缘表示各个线程的顺序执行。
(The above definitions provide a coherent set of increasing broader views of threads.) (上述定义提供了一组连贯的、不断增加的线程视图 )
    
- 
Example
       
       
答案取两者最小值
 
										