Embedded Systems Software Training Center Unit Testing Workshop Copyright © 2012 DSR Corporation.

Slides:



Advertisements
Similar presentations
Recursion.
Advertisements

E MBEDDED S YSTEMS S OFTWARE T RAINING C ENTER T EST D ESIGN T ECHNIQUES C OPYRIGHT © 2012 DSR C ORPORATION.
Applications of Synchronization Coverage A.Bron,E.Farchi, Y.Magid,Y.Nir,S.Ur Tehila Mayzels 1.
Container Classes A container class is a data type that is capable of holding a collection of items. In C++, container classes can be implemented as.
Marking Schema question1: 40 marks question2: 40 marks question3: 20 marks total: 100 marks.
Lecture # 21 Chapter 6 Uptill 6.4. Type System A type system is a collection of rules for assigning type expressions to the various parts of the program.
1 Software Engineering Lecture 11 Software Testing.
1 Lab Session-VI CSIT-120 Fall 2000 Let us look at C++ syntax rules in brief Next, we complete the lab session-V Lab session-VI deals with functions (OPTIONAL)
Copyright © 2006 Software Quality Research Laboratory DANSE Software Quality Assurance Tom Swain Software Quality Research Laboratory University of Tennessee.
Ch6: Software Verification. 1 Statement coverage criterion  Informally:  Formally:  Difficult to minimize the number of test cases and still ensure.
Specification and Implementation Separating the specification from implementation makes it easier to modify programs. Changes in the class’s implementation.
More Miscellaneous Topics CS-2301 B-term More Miscellaneous Topics CS-2301, System Programming for Non-majors (Slides include materials from The.
2011 Embedded Systems Software Training Center BluRapport SDK.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
2011 Embedded Systems Software Training Center BluRapport SDK.
Advanced Java New York University School of Continuing and Professional Studies.
University of Palestine software engineering department Testing of Software Systems Fundamentals of testing instructor: Tasneem Darwish.
1 Object-Oriented Programming Using C++ CLASS 27.
8 Copyright © 2009, Oracle. All rights reserved. Using Process Flows.
Path Testing + Coverage Chapter 9 Assigned reading from Binder.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 4 – Wage Calculator Application: Introducing.
Agenda Introduction Overview of White-box testing Basis path testing
Courtroom Protocol and Technology
CS 217 Software Verification and Validation Week 7, Summer 2014 Instructor: Dong Si
 A Collection class is a data type that is capable of holding a group of items.  In Java, Collection classes can be implemented as a class, along with.
Linked Lists. A linear linked list is a collection of objects, called nodes, each of which contains a data item and a pointer to the next node in the.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Stacks.
14 Copyright © Oracle Corporation, All rights reserved. SQL Workshop.
An Introduction to C++ A First Look. void Functions #include #include void main( ) { cout
15. WRITING LARGE PROGRAMS. Source Files A program may be divided into any number of source files. Source files have the extension.c by convention. Source.
A Test Case + Mock Class Generator for Coding Against Interfaces Mainul Islam, Christoph Csallner Software Engineering Research Center (SERC) Computer.
At the end of each day the evening manager at each store enters a code into the cash register, after which the cash register connects to the central computer.
Structural Testing Review Chapter Measuring Gaps and Redundancy We have seen that functional testing methods may produce test suites with serious.
Prof. amr Goneid, AUC1 CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 15. Dictionaries (1): A Key Table Class.
1 EBC Conference Introduction and Welcome.
Manipulator example #include int main (void) { double x = ; streamsize prec = cout.precision(); cout
1 Test Coverage Coverage can be based on: –source code –object code –model –control flow graph –(extended) finite state machines –data flow graph –requirements.
HW7: Due Dec 5th 23:59 1.Describe test cases to reach full path coverage of the triangle program by completing the path condition table below. Also, draw.
Classes Classes are a major feature of C++. They support – – Abstraction – Data hiding – Encapsulation – Modularity – Re-use through inheritance.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Digitaalsüsteemide verifitseerimise kursus1 Exercises Binary decision diagrams ROBDD generation. Shannon expansion Finding an optimal ordering Dynamic.
E MBEDDED S YSTEMS S OFTWARE T RAINING C ENTER T EST D ESIGN T ECHNIQUES C OPYRIGHT © 2012 DSR C ORPORATION.
 2000 Deitel & Associates, Inc. All rights reserved. Optional Case Study - Chapter 6 Outline 6.1 Introduction 6.2 Implementation: Visibility 6.3 Implementation:
Reducing a Set Covering Matrix. S I T E S Cost Areas
1 Object-Oriented Programming Using C++ CLASS 2 Honors.
Dynamic White-Box Testing What is code coverage? What are the different types of code coverage? How to derive test cases from control flows?
0 Design Change Construction & Completion Management (Outline and related procedures) Hanul NPP Engineering Center.
Structure Based Test Design
1 C++ Classes and Data Structures Course link…..
Template Classes.
Embedded Systems Software Training Center
The Joy of Breaking Code Testing Logic and Case Selection
CompSci 230 Software Construction
Introduction to ZBOSS Embedded Systems Software Training Center
A Test Case + Mock Class Generator for Coding Against Interfaces
Data Coverage and Code Coverage
CHAPTER 4 Test Design Techniques
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Separating Definition & Implementation
Classes.
Testing techniques and methods
Guide for writing a Software Testing Document
Language-based Security
Welcome to the TMS Media Center
ETS WG, 30 January-1 February 2006 Agenda Item
CSE 1020:Software Development
Code Organization Classes
Test Design Techniques Software Testing: IN3240 / IN4240
HW#7 Describe test cases to reach full path coverage of the triangle program by completing the path condition table below. Also, draw the complete execution.
UNIT-4 BLACKBOX AND WHITEBOX TESTING
Presentation transcript:

Embedded Systems Software Training Center Unit Testing Workshop Copyright © 2012 DSR Corporation

Objectives Implement unit tests and complete unit- testing procedure on existing code from previous workshops. Copyright © 2012 DSR Corporation 2

Agenda 1. Problem definition 2. Action items 3. Implementing unit-test technique 4. Code coverage analysis Copyright © 2012 DSR Corporation 3

Embedded Systems Software Training Center Problem definition Copyright © 2012 DSR Corporations

Problem definition Copyright © 2012 DSR Corporation Foundations of Software Testing. ISTQB Certification. Dorothy Graham, Erik Van Veenendaal 5 Task: Perform unit-testing procedure on existing code of bluetooth file transfer application. Deliviries: State diagram State transition matrix Source code (with implemented unit tests) Unit tests results Code coverage results

Embedded Systems Software Training Center Action Items Copyright © 2012 DSR Corporations

Action Items Copyright © 2012 DSR Corporation Foundations of Software Testing. ISTQB Certification. Dorothy Graham, Erik Van Veenendaal Prepare state diagram for BT connection, inquiry etc. Check all possible branches, return codes etc. Prepare state transition matrix for transfer protocol Design/Implement unit tests based on prepared diagram. Run unit tests. Check results. Got a code coverage. Tune tests if necessary, run 2 nd pass, check results. The final step of this technique is to write test cases to exercise each of the four rules in the table. Test cases may be enhanced with EP and BVA approaches. 7

Embedded Systems Software Training Center Unit tests implementation technique Copyright © 2012 DSR Corporations

Unit tests implementation Copyright © 2012 DSR Corporation Foundations of Software Testing. ISTQB Certification. Dorothy Graham, Erik Van Veenendaal 9 #define unit_test_1 /* enter Pin */ /* could be move to header */ //#define unit_test_2 //#define unit_test_3 ….. #Ifndef unit_test_1 int get_pin_num() {…} #else int get_pin_num(){return (int)3;} #endif

Embedded Systems Software Training Center Code coverage analysis Copyright © 2012 DSR Corporations

Code coverage example Copyright © 2012 DSR Corporation Foundations of Software Testing. ISTQB Certification. Dorothy Graham, Erik Van Veenendaal 11 void Drinker::Drink (bool beer, bool whiskey) { if (beer) { this->m_result = 1; /* Covered by Test ():1 */ } else { this->m_result = -1; /* Covered by Test ():2 */ } if (whiskey) { this->m_result = 2; /* Covered by Test ():1 */ } else { this->m_result = -2; /* Covered by Test ():2 */ } void Test() /* C0 (line coverage) is 100%, C1(branch coverage) is 100%, C2 (path coverage) is 50%. { Drinker dude = new Drinker(); dude.Drink(true, true); Assert::AreEqual(m_result, 1); dude.Drink(true, true); Assert::AreEqual(m_result, 2); }

Embedded Systems Software Training Center Thank you Copyright © 2012 DSR Corporations