Designing For Testability. Incorporate design features that facilitate testing Include features to: –Support test automation at all levels (unit, integration,

Slides:



Advertisements
Similar presentations
Test process essentials Riitta Viitamäki,
Advertisements

Testing Object Oriented Programs CSE 111 4/28/20151.
Programming Types of Testing.
Prototyping of Real-time Component Based Systems by the use of Timed Automata Trevor Jones Lancaster University, UK
NetComm Wireless Logging Architecture Feature Spotlight.
Chapter 19: Network Management Business Data Communications, 4e.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Automated Tests in NICOS Nightly Control System Alexander Undrus Brookhaven National Laboratory, Upton, NY Software testing is a difficult, time-consuming.
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
CONTENTS:-  What is Event Log Service ?  Types of event logs and their purpose.  How and when the Event Log is useful?  What is Event Viewer?  Briefing.
TIBCO Designer TIBCO BusinessWorks is a scalable, extensible, and easy to use integration platform that allows you to develop, deploy, and run integration.
Automating Tasks with Macros. Macro Essentials  A macro is a list of actions that happen when you run the macro.  Creating a Macro: − Choose Create.
UNIT-V The MVC architecture and Struts Framework.
Students: Nadia Goshmir, Yulia Koretsky Supervisor: Shai Rozenrauch Industrial Project Advanced Tool for Automatic Testing Final Presentation.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse 2.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
Hands-On Microsoft Windows Server 2008
1. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.
Benefits of PL/SQL. 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –List and explain the benefits of PL/SQL –List.
1 Validation & Verification Chapter VALIDATION & VERIFICATION Very Difficult Very Important Conceptually distinct, but performed simultaneously.
Guide to Linux Installation and Administration, 2e 1 Chapter 9 Preparing for Emergencies.
Chapter 8 – Software Testing Lecture 1 1Chapter 8 Software testing The bearing of a child takes nine months, no matter how many women are assigned. Many.
Capture-Replay Mocks Scandinavian Developer Conference 4 th April 2011 Geoff Bache.
Winrunner Usage - Best Practices S.A.Christopher.
INT-Evry (Masters IT– Soft Eng)IntegrationTesting.1 (OO) Integration Testing What: Integration testing is a phase of software testing in which.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Part 04 – Preparing to Deploy to the Cloud Entity Framework and MVC Series Tom Perkins NTPCUG.
Design and Programming Chapter 7 Applied Software Project Management, Stellman & Greene See also:
Reusability and Effective Test Automation in Telecommunication System Testing Mikael Mattas Supervisor: Professor Sven-Gustav Häggman Instructor: B.Sc.
Exploring an Open Source Automation Framework Implementation.
1 Software Construction and Evolution - CSSE 375 Exception Handling - Principles Steve Chenoweth, RHIT Above – Exception handling on the ENIAC. From
Cohesion and Coupling CS 4311
Hibernate Persistence. What is Persistence Persist data to database or other storage.  In OO world, persistence means persist object to external storage.
Unit Testing Maintaining Quality. How do you test? Testing to date…
Using Mock Objects with Test Driven Development Justin Kohlhepp
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
TEST-1 6. Testing & Refactoring. TEST-2 How we create classes? We think about what a class must do We focus on its implementation We write fields We write.
Building Secure Web Applications With ASP.Net MVC.
Today’s Agenda  Reminder: HW #1 Due next class  Quick Review  Input Space Partitioning Software Testing and Maintenance 1.
Mock objects.
Vinay Paul. CONTENTS:- What is Event Log Service ? Types of event logs and their purpose. How and when the Event Log is useful? What is Event Viewer?
Debugging Computer Networks Sep. 26, 2007 Seunghwan Hong.
PPT 4: Reproducing the Problem CEN Software Testing.
MySQL and GRID status Gabriele Carcassi 9 September 2002.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
1 CSE 331 Model/View Separation and Observer Pattern slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Outsourcing, subcontracting and COTS Tor Stålhane.
Unit Testing with FlexUnit
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
Google C++ Testing Framework Part 2: Assertion. Concepts A test case contains one or many tests. ◦ You should group your tests into test cases that reflect.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Architecture Review 10/11/2004
Unit Testing.
Group mambers: Maira Naseer (BCS ).
Integration Testing.
z/Ware 2.0 Technical Overview
Software Testing Techniques
Introduction to JUnit CS 4501 / 6501 Software Testing
Designing For Testability
Chapter 8 – Software Testing
Coding Defensively Coding Defensively
Deploying and Configuring SSIS Packages
TRANSLATORS AND IDEs Key Revision Points.
Introduction to JUnit CS 4501 / 6501 Software Testing
CS 240 – Advanced Programming Concepts
Applying Use Cases (Chapters 25,26)
Designing For Testability
Framework Anil
Presentation transcript:

Designing For Testability

Incorporate design features that facilitate testing Include features to: –Support test automation at all levels (unit, integration, system) –Provide visibility into the program’s internal state and activities This allows more specific and accurate bug reports It also helps during debugging

Logs class Log { public: const int DEBUG = 1; const int INFO = 2; const int WARNING = 3; const int ERROR = 4; const int FATAL = 5; // send log output to the console Log(); // send log output to a file Log(const string & file); // Send log output to a remote server Log(const string & serverIpAddress, int serverPort); // enable/disable different message types void EnableMessageType(int type); void DisableMessageType(int type); // Log messages of various types void Debug(const string & message); void Info(const string & message); void Warning(const string & message); void Error(const string & message); void Fatal(const string & message); }; Log important events to a log file Example Log File Provide a configuration file that allows logging to be turned on and off in different application modules

Logging Events to consider –Significant processing in a subsystem. –Major system milestones. These include the initialization or shutdown of a –subsystem or the establishment of a persistent connection. –Internal interface crossings. –Internal errors. –Unusual events. These may be logged as warnings and a sign of trouble if they happen too often. –Completion of transactions.

Logging When an error occurs, save the ring buffer containing most recent logged events Include timestamps Variable logging levels Take advantage of logging already present May be able to instrument the executable Determine how logs correlate to actions in the software

MVC Using a Model-View-Controller design that separates Views and Controllers into separate classes allows automated testing of Controller logic All code with any GUI library dependencies goes in the Views All other GUI code goes in the Controllers This allows all GUI code that does not touch the GUI library to be tested in an automated fashion Test driver passes Controllers “mock” Views that implement the IView interface

The “Mock Object” design pattern Allows “mock objects” to be inserted anywhere in a program Allows a class to be isolated from its dependencies during unit testing, or for other reasons (e.g., a class I depend on doesn’t exist yet, or I want to avoid calling it for some reason) Supports “fault injection” –Cause the software to fail at points where it normally wouldn’t to test error handling code Example: URL Spelling Checker

Mock objects can simulate the behavior of complex, real (non-mock) objects and are therefore useful when a real object is impractical or impossible to incorporate into a unit test. If an object has any of the following characteristics, it may be useful to use a mock object in its place: –supplies non-deterministic results (e.g., current time or current temperature); –has states that are difficult to create or reproduce (e.g., a network error); –is slow (e.g., a complete database, which would have to be initialized); –does not yet exist or may change behavior; –would have to include information and methods exclusively for testing purposes (and not for its actual task). Mock object method implementations can contain assertions of their own. This means that a true mock, in this sense, will examine the context of each call— perhaps checking the order in which its methods are called, perhaps performing tests on the data passed into the method calls as arguments. The “Mock Object” design pattern

Dependency Injection Technique that allows “mock objects” to be inserted anywhere in a program –Easier to implement than the Mock Object pattern Choose a “Dependency Injection Container” –Ninject, Google Guice, etc. Configure your dependency injection container with a mapping from abstract interfaces to concrete classes that implement them Create objects by asking the dependency injection container for an implementation of an abstract interface Allows program code to depend on abstract interfaces, and not on concrete classes Allows mock objects to be easily inserted anywhere in the code Dependency Injection Example

Provide automation interfaces When possible, test cases should be automated (i.e., test drivers that run test cases and automatically verify results) User interfaces often do not lend themselves to automation (especially GUIs) –Record and Playback tools –Tools that programmatically drive the application by generating simulated UI events Programs can provide “automation interfaces” that allow test drivers to run commands and query application state without going through the user interface

Provide automation interfaces Automated test cases can exercise the application through: –The Core Object Model –UI Controllers (using mock Views) –A command-line interface (CLI) inventory-tracker add-item inventory-tracker print-product-stats Etc. –A web-service interface that allows test cases to drive the application remotely

Data generators Creating large data sets by hand is not feasible –Think about trying to manually enter large amounts of item and product data into Inventory Tracker Data Generator –A program that generates large amounts of test data –Configuration parameters let the user “shape” the generated data –Example: Generate an XML file that can be used with Inventory Tracker’s XML Importer