DETAILED DESIGN IMPLEMENTATIONA AND TESTING Instructor Dr Hany

  • Slides: 37
Download presentation
DETAILED DESIGN, IMPLEMENTATIONA AND TESTING Instructor: Dr. Hany H. Ammar Dept. of Computer Science

DETAILED DESIGN, IMPLEMENTATIONA AND TESTING Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU

OUTLINE n The Detailed design, Implementation, and testing phase in the software development standards

OUTLINE n The Detailed design, Implementation, and testing phase in the software development standards – n The ESA standard, and the 498 Standard Software Testing – Black Box Testing, White Box Testing n n n Cause-Effect graphing Scenario-based Testing Software Testing Documents n n The IEEE 829 Standard Software Testing Document Template

Detailed design, Implementation, and Testing n In the European Space Agency standard, the major

Detailed design, Implementation, and Testing n In the European Space Agency standard, the major activities in this phase include - decomposition and the specification of the lowlevel software modules. the low-level components specified at the architectural design are decomposed into software modules. - This is followed by software production and documentation: implementing the modules specifications into code, integrating the software components, and the testing

Detailed design, Implementation, and Testing in the ESA standard

Detailed design, Implementation, and Testing in the ESA standard

Detailed Design Phase Activities Examine the ADD and confirm that it is understandable. n

Detailed Design Phase Activities Examine the ADD and confirm that it is understandable. n Detailed Design: starts with the major components defined in the ADD, and continues to decompose them until the components can be expressed as simple modules in the selected programming languages. n

Detailed Design Decomposition of low-level components - Using stepwise refinement, the low-level components specified

Detailed Design Decomposition of low-level components - Using stepwise refinement, the low-level components specified at the architectural design are decomposed into software modules, and Library modules (language dependent Application Programming Interfaces APIs, e. g. , Microsoft Foundation Classes, Java API packages for Graphical User Interfaces or GUIs, network programming, etc. )

Example: Integrated Electronic Technical Manual Architecture UML Component Diagram Data Services Business Services IETM

Example: Integrated Electronic Technical Manual Architecture UML Component Diagram Data Services Business Services IETM Object Model User Services IETM Object Model Interfaces

IETM Object Model Detailed Design Class Diagram of he IETM Object Model Component Architectural-Forms

IETM Object Model Detailed Design Class Diagram of he IETM Object Model Component Architectural-Forms id : ID cdm : NAME ref : IDREF 0. . * Information. Content-Forms 1. . * <<Stereotype>> IF-NODE Condition : expression Then. Seq : NODE-SEQ Else. Seq [0. . 1] : NODE-SEQ select. Flow() get. Then. Seq() <<Stereotype>> NODE-ALTS Nodes : NODE Eval_Alts() 1 <<Stereotype>> NODE name : CDATA type : CDATA itemid : CDATA preconditions [0. . *] : precond postconditions [0. . *] : postcond Contents : Information. Content-Forms 1. . * primitives [0. . *] : %primitive links [0. . *] : %link Display() Set_Post_Conditions() 1 Eval_Pre_Conditions() has. Contents() <<Stereotype>> LOOP-NODE Index. Declare [0. . 1] : assertion Exit. Cond : expression Index. Alter [0. . 1] : assertion Repeat. Seq : NODE-SEQ Start() Eval_Condition() Update_Index() Terminate() 1 1 <<Stereotype>> NODE-SEQ Seq. Elements : Architectural-Forms get. Next. Element() step. Back() has. More. Elements() Reset() 1

Detailed Design n Decomposition of low-level components (cont. ) In OOD services of relatively

Detailed Design n Decomposition of low-level components (cont. ) In OOD services of relatively complex classes can be delegated to new classes using design patterns to refine the design class design v Complex operations in a class can be refined using stepwise refinements into subordinate simpler operations in the same class (Interface operations depend on private operations), or by delegating these operations to new classes using design patterns v

Example: ATM State. Chart The State Pattern can be used iteratively

Example: ATM State. Chart The State Pattern can be used iteratively

Detailed Design: Decomposition of low-level components n n n Specify the detailed design of

Detailed Design: Decomposition of low-level components n n n Specify the detailed design of subordinate modules (e. g. , class operations) and outline the module processing in a Flow Chart (or UML Activity diagrams), Program Design Language (PDL), or pseudo-code PDLs and pseudo-code can be included later in the code as comments, easing maintenance, whereas flowcharts cannot. Flowcharts are not compatible with the stepwise refinement technique, and so PDLs and pseudo-code are to be preferred to flowcharts for detailed design. Specify how buffers are structured (the data structures of the buffers used for inputs and outputs)

Detailed Design: Decomposition of low-level components n Defensive design – – Anticipate possible problems

Detailed Design: Decomposition of low-level components n Defensive design – – Anticipate possible problems and include defenses against them (Exception Handling) Principles of defensive design: n mutual suspicion; Modules should be designed to handle erroneous input and error reports from other modules. n immediate detection; detect error where they occur in the lower level functions (not at the higher levels of the function call hierarchy)

Implementation, and Testing Software production phase Software production consists of n Implementing the modules

Implementation, and Testing Software production phase Software production consists of n Implementing the modules specifications into code (structured Programming or object-oriented programming), n Integrating the software components and the testing activities in testing procedures of – – – Unit testing: testing each software unit Integration testing: integrating and testing several units, System testing: testing the whole system

Implementation, and Unit Testing The activities required in the MIL-STD-498 standard for the Software

Implementation, and Unit Testing The activities required in the MIL-STD-498 standard for the Software Implementation and Unit Testing (SWIUT) are described as follows: - Develop and document software corresponding to each software unit (CSU) of each software component (CSC) in the CSCI design - Establish test cases (in terms of inputs, expected results, and evaluation criteria), test procedures, and test data for testing the software corresponding to each software unit

Implementation, and Unit Testing The test cases shall cover all aspects of the unit's

Implementation, and Unit Testing The test cases shall cover all aspects of the unit's detailed design. The developer shall record this information in the appropriate software development files (SDFs) n Test the software corresponding to each software unit. The testing shall be in accordance with the unit test cases and procedures n

Implementation, and Unit Testing n n Make all necessary revisions to the software, perform

Implementation, and Unit Testing n n Make all necessary revisions to the software, perform all necessary retesting, and update the software development files (SDFs) and other software products as needed, based on the results of unit testing Analyze the results of unit testing and record the test and analysis results in appropriate software development files (SDFs)

Software Testing What is Software Testing? n Is the process of executing a program

Software Testing What is Software Testing? n Is the process of executing a program with an established set of test cases n A test case is a software testing document, which consists of event, action, input, output, expected result, and actual result (also defined as set of test inputs, executions, and expected results developed for a particular objective) n Test cases are designed according to well defined procedures or techniques n Testing is a bottom-up process, starts with Unit testing (testing each sw unit, Integration testing (testing several components), and System testing

Software Unit Testing Set of test cases Test Driver Module under test Data Module

Software Unit Testing Set of test cases Test Driver Module under test Data Module Stub

Software Unit Testing The test driver is developed based on a design set of

Software Unit Testing The test driver is developed based on a design set of test cases n The driver invokes the module under test for each test case and establishes the test case data/control requirements n Stubs are sub-ordinate dummy modules that represent the modules (including global data structures) invoked (or accessed) by the module under test n They contain print and return statements n

Software Testing Techniques Designing Test Cases n Testing techniques consist of - Black Box

Software Testing Techniques Designing Test Cases n Testing techniques consist of - Black Box testing, where we focus on testing the software functional requirements, and testing the input/output interfaces Inputs Outputs Module under test Is treated as a Black Box

Software Testing Techniques – White Box Testing, where we focus on developing test cases

Software Testing Techniques – White Box Testing, where we focus on developing test cases to cover the logical paths through the code Also called Path Testing (e. g. , conditional statements, loops, etc. ) n Based on developing a control flow graph of the code under test to identify the set of independent paths, and produce a set of test cases to cover these paths (statement coverage, Independent path coverage)

Software Testing Techniques n n Black Box Testing Techniques 1. Equivalence Partitioning Partition the

Software Testing Techniques n n Black Box Testing Techniques 1. Equivalence Partitioning Partition the input space into equivalence classes and develop a test case for each class of inputs 2. Boundary value analysis develop test cases at the boundaries of the possible input ranges (minimum and maximum values) The above techniques are important for data processing intensive applications

Software Testing Techniques n n Black Box Testing Techniques (cont. ) 3. Cause-effect graphing

Software Testing Techniques n n Black Box Testing Techniques (cont. ) 3. Cause-effect graphing - Used for control intensive applications, - Develops test cases to represent input events (or causes) and the corresponding actions (or effects) This technique is used intensively in real-time systems

Software Testing Techniques n Cause-effect graphing consists of the following 4 steps 1. List

Software Testing Techniques n Cause-effect graphing consists of the following 4 steps 1. List and label causes (input-events) and effects (output actions) for a module 2. Draw a cause-effect graph describing the logical combinations of causes, intermediate causes and resulting effects, 3. Develop a decision table (causes vs effects) from the graph (each raw consists of a combination of causes and the resulting effects) 4. Convert each row into a test case, or a set of rows into a testing scenario

Software Testing Techniques Symbols used in the cause-effect graphs ci = ith cause, ei

Software Testing Techniques Symbols used in the cause-effect graphs ci = ith cause, ei = ith effect ci ei Ci causes ei ci cj ei OR ci ei Ci does Not cause ei ci cj ei AND

Software Testing Techniques n 1. Example: Control motion module in the automated train sodware

Software Testing Techniques n 1. Example: Control motion module in the automated train sodware project (assume the module inputs are a state variable and a control input) List and label all Causes and all effects Causes Effects C 1: Start C 2: Idle e 100: Release all Brakes e 200: Engage_Engine C 3: speed = Max_speed C 4: Accelerating C 5: Speed > Max_speed C 6: Coasting C 7: Speed <= Min_speed e 300: Disengage_Engine e 400: Apply Ph. 1 Brakes e 500: Release Ph. 1 brakes e 600: Apply Ph. 2 brakes e 700: Apply Safety brakes

Software Testing Techniques This List is obtained form the following STD Coasting Speed >

Software Testing Techniques This List is obtained form the following STD Coasting Speed > Max_speed / Apply Ph. 1 brakes Speed <= Speed = Max_speed / Min_speed/ Disengage_Engine Engage Engine. Accelerating Start / Rlease all Braks Engage Engine Idle Decelerating Stop / stopping Speed = Stopping_Speed Applying ph II

Software Testing Techniques Develop a Cause effect graph c 1 e 10 c 2

Software Testing Techniques Develop a Cause effect graph c 1 e 10 c 2 e 200 c 3 e 20 c 4 e 40 c 7 e 100 e 300 c 5 c 6 e 30 e 400

Software Testing Techniques Develop a Decision Table C 1 C 2 C 3 C

Software Testing Techniques Develop a Decision Table C 1 C 2 C 3 C 4 C 5 C 6 C 7 e 100 e 200 e 300 e 400 1 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 n Convert each row to a test case n

The same technique can be applied to our ATM project Example State Diagram, Simplified

The same technique can be applied to our ATM project Example State Diagram, Simplified

Example: ATM State. Chart More Elaborate

Example: ATM State. Chart More Elaborate

Software Testing Techniques Scenario testing: Defines a test case that combines a set of

Software Testing Techniques Scenario testing: Defines a test case that combines a set of simpler test cases for testing the system behavior over a period of time n A design sequence diagram is used to define the scenario and derive the implementation of the test driver n Example: in Control Motion testing, the scanrios can be defined wit the following sequence of inputs Start, idle ; speed = max_speed, Accelerating; Speed < = Min_speed, Coasting; Stop, Accelerating; speed = stop speed; start, Idle; speed = max_speed, Accelerating; speed > Max_speed, Coasting; n

Software Testing Documents The IEEE 829 Standard IEEE 829 standard for Software Test Documentation

Software Testing Documents The IEEE 829 Standard IEEE 829 standard for Software Test Documentation provides documentation guidelines in three distinct phases of software testing n 1. Preparation Of Tests – – – n 2. Running The Tests – – n Test Plan: Plan how the testing will proceed. Test Design Specification: Decide what needs to be tested. Test Case Specification: Create the tests to be run. Test Procedure: Describe how the tests are run. Test Item Transmittal Report: Specify the items released for testing. Test Log: Record the details of tests in time order. Test Incident Report: Record details of events that need to be investigated. 3. Completion of Testing – Test Summary Report: Summarize and evaluate tests

Software Testing Documents n n n IEEE 829 - Test Design Specification (what feature

Software Testing Documents n n n IEEE 829 - Test Design Specification (what feature do we want to test? ) Creating the test design is the first stage in developing the tests for a software testing project. It records what needs to be tested, and is derived from the documents that come into the testing stage, such as requirements and designs. It records which features of a test item are to be tested, and how a successful test of these features would be recognized. As an example lets use a Billing project from which the following testing requirements may be defined: – A normal bill can be produced. – A final bill can be produced. – The volume discount is properly calculated. The test design does not record the values to be entered for a test, but describes the requirements for defining those values

Software Testing Documents IEEE 829 - Test Case Specification (how features will be tested?

Software Testing Documents IEEE 829 - Test Case Specification (how features will be tested? ) n The test cases are produced when the test design is completed. Test cases specify for each testing requirement: – The exact input values that will be input and the values of any standing data that is required, – The exact output values and changes of value of the internal system state that are expected, – And any special steps for setting up the tests. n A feature from the Test Design may be tested in more than one Test Case, and a Test Case may test more than one feature. The aim is for a set of test cases to test each feature from the Test Design at least once. Taking the Billing project example all three requirements could be tested using two test cases: – The first test case could test both that a normal bill is produced and that a volume discount is properly calculated. – A second test case could check that a final bill is produced and a volume discount is calculated

Software Testing Documents, STD Document Template 1. BACKGROUND – This item summarizes the functions

Software Testing Documents, STD Document Template 1. BACKGROUND – This item summarizes the functions of the application system and the tests to be performed. 2. INTRODUCTION- The scope of this document, referenced documents, and the organization of this document 3. ASSUMPTIONS – Indicates any anticipated assumptions which will be made while testing the application. 4. TEST ITEMS - List each of the items (Classes, Program Files) to be tested. 5. FEATURES TO BE TESTED - List each of the features (Use-Cases, scenarios, functions, or requirements) which will be tested or demonstrated by the test. 6. FEATURES NOT TO BE TESTED - Explicitly lists each feature, function, or requirement which won't be tested and why not. 7. APPROACH - Describe the data flows and test philosophy. 8. TEST CASES – Describe each test case in a subsection as shown in the next slide

Software Testing Documents, STD Document Template test case id: unique number or name test

Software Testing Documents, STD Document Template test case id: unique number or name test case name: previously selected test case title feature to be tested: the name of the scenario corresponding module functionality test suit id: the name of test batch id, in which batch this case is a member. Priority: the importance of this test case w. r. t functionality (high, low) test environment: required h/w and s/w to execute these test cases. Pre-condition: necessary tasks to do before starting the test execution test procedure/log: a step by step procedure to execute this test case, step no. , Action , i/p required, expected result, actual result, comment test case pass / fail criteria: when this case is "pass", when this case is "fail"