Designing For Testability

Slides:



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

Testing Object Oriented Programs CSE 111 4/28/20151.
Mike Azocar Sr. Developer Technical Specialist Microsoft Corporation
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.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
WaveMaker Visual AJAX Studio 4.0 Training Troubleshooting.
MySQL in PHP – Page 1 of 17CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: MySQL in PHP Reading: Williams &
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
Designing For Testability. Incorporate design features that facilitate testing Include features to: –Support test automation at all levels (unit, integration,
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 and Replay Often used for regression test development –Tool used to capture interactions with the system under test. –Inputs must be captured;
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.
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.
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.
Mock objects.
PPT 4: Reproducing the Problem CEN Software Testing.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Unit Testing with FlexUnit
T EST T OOLS U NIT VI This unit contains the overview of the test tools. Also prerequisites for applying these tools, tools selection and implementation.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
SOFTWARE TESTING TRAINING TOOLS SUPPORT FOR SOFTWARE TESTING Chapter 6 immaculateres 1.
Progress Apama Fundamentals
Architecture Review 10/11/2004
© University of Liverpool
Chapter 19: Network Management
Unit Testing.
Group mambers: Maira Naseer (BCS ).
Testing Tutorial 7.
Integration Testing.
Security Testing Methods
Project Center Use Cases
z/Ware 2.0 Technical Overview
Section 13 - Integrating with Third Party Tools
Chapter 5: Using System Software
Test Automation CS 4501 / 6501 Software Testing
Introduction to JUnit CS 4501 / 6501 Software Testing
Informatica PowerCenter Performance Tuning Tips
Chapter 8 – Software Testing
Chapter 2: System Structures
22-INTEGRATION HUB
Coding Defensively Coding Defensively
Deploying and Configuring SSIS Packages
Software Quality Assurance
TRANSLATORS AND IDEs Key Revision Points.
Modeling Cyberspace Operations
Design by Contract Fall 2016 Version.
Mocking Your Objects with Impunity
Chapter 24 Testing Object-Oriented Applications
The Object-Oriented Thought Process Chapter 05
Model-View-Controller Patterns and Frameworks
Introduction to JUnit CS 4501 / 6501 Software Testing
Sharing the good, the bad, the ugly & What can we do about it?
Test Automation CS 4501 / 6501 Software Testing
Chapter 19 Testing Object-Oriented Applications
Testing RESTful Web APIs
Course: Module: Lesson # & Name Instructional Material 1 of 32 Lesson Delivery Mode: Lesson Duration: Document Name: 1. Professional Diploma in ERP Systems.
Chapter 19 Testing Object-Oriented Applications
CS 240 – Advanced Programming Concepts
Applying Use Cases (Chapters 25,26)
Applying Use Cases (Chapters 25,26)
Designing For Testability
Lecture 34: Testing II April 24, 2017 Selenium testing script 7/7/2019
Database management systems
Framework Anil
Presentation transcript:

Designing For Testability

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 Tools for putting the system in particular states for different testing scenarios, and for saving/restoring the system’s state

Logs Log important events to a log file Example Log File 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

The “Mock Object” design pattern 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.

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 Automating system-level tests 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 let test scripts programmatically drive the application by generating simulated UI events Programs can provide “automation interfaces” that allow test scripts to run commands and query application state without going through the user interface

Provide automation interfaces Automated test cases can exercise the application through: A command-line interface (CLI) catan place-road <player-index> <edge-location> catan get-hex-contents <hex-location> 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

Save/Restore System State Include ability to save and restore the current state of the system at arbitrary points This facilitates testing by enabling testers to quickly place the system in a state needed to run certain test cases This facilitates logging of bugs and subsequent debugging When a tester finds a bug, they can save the current state of the system, and attach it to the bug report Developers can use the attached state to restore the system to the erroneous state. EXAMPLE: The following web service APIs from Catan /games/save /games/load /game/reset /game/commands (GET and POST)