Unit Test Pattern.

Slides:



Advertisements
Similar presentations
Unit-Testing Presented by Benny Pasternak November 2005 Program testing can be used to show the presence of bugs, but never to show their absence! - Edsger.
Advertisements

SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
SE 450 Software Processes & Product Metrics Reliability: An Introduction.
Chapter 8 Physical Database Design. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Overview of Physical Database.
Advance Unit Test, Part V -Unit Test Patterns By Marc Clifton Presentation By Yasir Ibrahim.
Chapter 13 & 14 Software Testing Strategies and Techniques
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
TESTING.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Physical Database Design Chapter 6. Physical Design and implementation 1.Translate global logical data model for target DBMS  1.1Design base relations.
© Logicalis Group Using DB2/400 effectively. Data integrity facilities Traditional iSeries database usage Applications are responsible for data integrity.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Unit Tests Руслан Трифонов Omegasoft Ltd.. Съдържание 1.Въведение 2.Unit test patterns 2.1. Pass/fail patterns 2.2. Collection management patterns 2.3.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Software Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
Chapter 8 Physical Database Design. Outline Overview of Physical Database Design Inputs of Physical Database Design File Structures Query Optimization.
ISBN Prentice-Hall, 2006 Chapter 8 Testing the Programs Copyright 2006 Pearson/Prentice Hall. All rights reserved.
SOFTWARE TESTING. Introduction Software Testing is the process of executing a program or system with the intent of finding errors. It involves any activity.
Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
CS223: Software Engineering Lecture 19: Unit Testing.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
SOFTWARE TESTING AND QUALITY ASSURANCE. Software Testing.
(1) Organize information processing centers environment, the various functions and details Electronic Data Processing (EDP): can refer to the use of automated.
LECTURE 10 Semantic Analysis. REVIEW So far, we’ve covered the following: Compilation methods: compilation vs. interpretation. The overall compilation.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
CS222: Principles of Data Management Lecture #4 Catalogs, Buffer Manager, File Organizations Instructor: Chen Li.
CS4222 Principles of Database System
Introduction To DBMS.
Software Testing.
Software Metrics 1.
Software Testing.
CS522 Advanced database Systems
Record Storage, File Organization, and Indexes
Operating System Interface between a user and the computer hardware
Chapter 6 - Database Implementation and Use
CS223: Software Engineering
Methodological Issues in Model-Based Testing (MBT)
Key Ideas from day 1 slides
Behavioral Design Patterns
Database Management System
CHAPTER 3 Architectures for Distributed Systems
Modern Systems Analysis and Design Third Edition
Chapter 13 & 14 Software Testing Strategies and Techniques
Structural testing, Path Testing
Types of Testing Visit to more Learning Resources.
Database System Concepts and Architecture
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Introduction lecture1.
Chapter 2 Database Environment Pearson Education © 2009.
Chapter 2 Database Environment.
Predictive Performance
Software testing strategies 2
Test Planning Mike O’Dell (some edits by Vassilis Athitsos)
Lecture 09:Software Testing
Physical Database Design
Chapter # 7 Introduction to Structured Query Language (SQL) Part II.
Software Design Lecture : 9.
Chapter 10 – Software Testing
CSE403 Software Engineering Autumn 2000 More Testing
Relational Database Design
Chapter 2 Database Environment Pearson Education © 2009.
Chapter 2 Database Environment Pearson Education © 2009.
Triggers 7/11/2019 See scm-intranet.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
08120: Programming 2: SoftwareTesting and Debugging
Responding to Data Manipulation Via Triggers
Chapter 13 & 14 Software Testing Strategies and Techniques 1 Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Presentation transcript:

Unit Test Pattern

Unit Testing The focus is the module a programmer has written Most often UT is done by the programmer himself UT will require test cases for the module UT also requires drivers to be written to actually execute the module with test cases Besides the driver and test cases, tester needs to know the correct outcome as well

Unit Test Pattern Good unit tests are difficult to write "the code is good when it passes the unit tests“ Unit test should be written first, before the code that is to be tested Challenges Unit testing must be formalized Design also must be formally performed

Unit Test Patterns Pass/fail patterns Collection management patterns Data driven patterns Performance patterns Simulation patterns Multithreading patterns Stress test patterns Presentation layer patterns Process patterns

Pass/Fail Patterns First line of defense to guarantee good code Simple-Test Pattern Code-Path Pattern Parameter-Range Pattern

Simple Test-Pattern Code Pass/Fail results tell us that Expected Result Condition A Condition B Expected Failure Pass/Fail results tell us that the code under test will work/trap an error given the same input (condition) as in the unit test No real confidence that the code will work correctly or trap errors with other set of conditions

Code-Path Pattern Emphasizes on conditions that Code paths Code path A Path result Code path B Path result Emphasizes on conditions that test the code paths with in the unit rather than conditions that test for pass/fail Results are compared to expected output of given code path Caveat: How do you test code-paths if tests are written first?

Parameter-Range Pattern Success set Code paths Code path A Path result Code path B Path result Failure set Code-Path pattern with more than a single parameter test

Data Driven Test Patterns Patterns which enable testing units with a broad range of input output pairs Simple-Test-Data Pattern Data-Transformation-Test Pattern

Simple-Test-Data Pattern Data Set Input Output Computation Code Unit Test Verify Result Reduces complexity of Parameter-Range unit by separating test data from the test. Test data is generated and modified independent of the test Results are supplied with the data set. Candidates for this pattern: Checksum Calculations, algorithims, etc…

Data-Transformation-Test Pattern Input test data Validation Transformation code Unit test Measurement Works with data in which a qualitative measure of the result must be performed. Typically applied to transformation algorithms such as lossy compression

Data Transaction Patterns Patterns embracing issues of data persistence and communication Simple-Data-I/O Pattern Constraint Data Pattern The Rollback Pattern

Simple-Data-I/O Pattern Service Write test Read Test Verifies the read/write functions of the service

Constraint Data Pattern Nullable Unique Default value Foreign key Cascading update Cascading delete Service Write test Constraints Adds robustness to Simple-Data-I/O pattern by Testing more aspects of the service Any rules that the service may incorporate Unit test verifies the service implementation itself For example, DB schema, web service, etc…

Rollback Pattern Verifies rollback correctness Service Write test Write test Verifies rollback correctness Most transactional unit tests should incorporate ability to rollback dataset to known state In order to undo test side effects

Collection Management Patterns Used to verify that the code is using the correct collection Collection-Order Pattern Enumeration Pattern Collection-Constraint Pattern Collection-Indexing Pattern

Collection-Order Pattern Unordered Code Containing Collection Unordered data Sequenced Ordered Verifies expected results when given an unordered list The test validates that the result is as expected Unordered, ordered or same sequence as input Provides implementer with information on how the container manages the collections

Code Containing Collection Enumeration Pattern Edge test Code Containing Collection Expected datum Enumerator (FWD, REV) Collection Verifies issues of enumeration or collection traversal Important test when connections are non-linear. E.g. collection tree nodes Edge conditions (past first or last item) are also important to test

Collection-Constraint Pattern Write test Collection container Nullable Unique Constraints Verifies that the container handles constraint violations Null values and duplicate keys Typically applies to key-value pair collections

Collection-Indexing Pattern Write test Collection container Index Key Out of bound index Update/ Delete Index Index test Verifies and documents indexing methods that the collection must support – by index and/or by key Verifies that update and delete transactions that utilize indexing are working properly and are protected against missing indexes

Performance Patterns Used to test non functional requirements as performance and resource usage Performance-Test Pattern

Performance-Test Pattern Pass Metric at Start Metric at End Code Pass criteria Fail Types of performance that can be measured: Memory usage (physical, cache, virtual) Resource (handle) utilization Disk utilization (physical, cache) Algorithm Performance (insertion, retrieval)

Pattern Summary Unit Test patterns cover broad aspects of development; not just functional May promote unit testing to become a more formal engineering discipline Helps identify the kind of unit tests to write, and its usefulness. Allows developer to choose how detailed the unit tests need to be