Software testing techniques Software testing techniques Software Testability Presentation on the seminar Kaunas University of Technology.

Slides:



Advertisements
Similar presentations
Software Testing Techniques
Advertisements

Chapter 14 Software Testing Techniques - Testing fundamentals - White-box testing - Black-box testing - Object-oriented testing methods (Source: Pressman,
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Test-Driven Development and Refactoring CPSC 315 – Programming Studio.
A Brief Introduction to Test- Driven Development Shawn M. Jones.
Case Tools Trisha Cummings. Our Definition of CASE  CASE is the use of computer-based support in the software development process.  A CASE tool is a.
(Quickly) Testing the Tester via Path Coverage Alex Groce Oregon State University (formerly NASA/JPL Laboratory for Reliable Software)
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
Test-Driven Development and Refactoring Project 3 Lecture 1 CPSC 315 – Programming Studio Fall 2009.
Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
Applied Software Project Management Andrew Stellman & Jennifer Greene Applied Software Project Management Applied Software.
Object Oriented Development and Practices In SharePoint Mostly.
Introduction to Software Testing
Test-Driven Development “Test first, develop later!” –OCUnit.
Test Driven Development Derived from Dr. Fawcett’s notes Phil Pratt-Szeliga Fall 2009.
1)Never start coding unless you understand the task! 2)Gather requirements first. This means identify the problem and ask questions about it. Now you kind.
UNIT-V The MVC architecture and Struts Framework.
Test-Driven Development With Visual Studio 2005 Erno de Weerd Info Support.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
Introduction to Unit Testing Jun-Ru Chang 2012/05/03.
Software Testing Life Cycle
Test Driven Development Arrange, Act, Assert… Awesome Jason Offutt Software Engineer Central Christian Church
Testing -- Part II. Testing The role of testing is to: w Locate errors that can then be fixed to produce a more reliable product w Design tests that systematically.
Junit At the forefront of Test Driven Development.
System Test Methods TESTTEME The Test Challenge Bottom Up Testing Strategy Integration Test System Test Types of Testing Unit Test = Code-based Testing.
1cs Intersection of Concurrent Accesses A fundamental property of Web sites: Concurrent accesses by multiple users Concurrent accesses intersect.
Today’s Agenda  HW #1  Finish Introduction  Input Space Partitioning Software Testing and Maintenance 1.
Debugging Strategies from Software Carpentry. Agan's Rules Many people make debugging harder than it needs to be by: Using inadequate tools Not going.
Software Construction Lecture 18 Software Testing.
A Practical Guide To Unit Testing John E. Boal TestDrivenDeveloper.com.
LCG-SPI: SW-Testing LCG AppArea internal review (20/10/03)
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
Refactoring & Testability. Testing in OOP programming No life in flexible methodologies and for refactoring- infected developers without SOME kind of.
Magnus
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Roy Osherove Sela Group ISerializable.com (blog)
Interoperability Testing. Work done so far WSDL subgroup Generated Web Service Description with aim for maximum interoperability between various SOAP.
Scalatest. 2 Test-Driven Development (TDD) TDD is a technique in which you write the tests before you write the code you want to test This seems backward,
Engineering Self-adaptive Service Mashups Mahdi Bashari LS3 Colloquium May 7 th 2014.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Testing Spring Applications Unit Testing.
(1) Test Driven Development Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii Honolulu.
What is a level of test?  Defined by a given Environment  Environment is a collection of people, hard ware, software, interfaces, data etc.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
Refactoring Agile Development Project. Lecture roadmap Refactoring Some issues to address when coding.
Clean Code “Keep it Clean, Your Mother Doesn’t Work Here”“Keep it Clean, Your Mother Doesn’t Work Here” William PenberthyWilliam Penberthy Application.
Test Driven Development Introduction Issued date: 8/29/2007 Author: Nguyen Phuc Hai.
( = “unknown yet”) Our novel symbolic execution framework: - extends model checking to programs that have complex inputs with unbounded (very large) data.
CS 5150 Software Engineering Lecture 22 Reliability 3.
Northwest Arkansas.Net User Group Jay Smith Tyson Foods, Inc. Unit Testing nUnit, nUnitAsp, nUnitForms.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Mantas Radzevičius ifm-2/2
Automated Software Testing
Programų testuojamumas
Neringa Sipavičienė IFM-2/4
Test-Driven Development
Software Metrics 1.
Software Testing.
The Development Process of Web Applications
Test Automation CS 4501 / 6501 Software Testing
Chapter 8 – Software Testing
Boolean logic Taken from notes by Dr. Neil Moore
Introduction to Software Testing
Design and Programming
Test Automation CS 4501 / 6501 Software Testing
CSE 303 Concepts and Tools for Software Development
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Outline Chapter 2 (cont) OS Design OS structure
Boolean logic Taken from notes by Dr. Neil Moore
Designing For Testability
Software Development Chapter 1.
Presentation transcript:

Software testing techniques Software testing techniques Software Testability Presentation on the seminar Kaunas University of Technology

Motivation Poor testability Ineffective testing Severe penalties

What is Software Testability? degree to which a software artifact (i.e. a software system, software module, requirements- or design document) supports testing in a given test context.

Software Testability …... is not an intrinsic property of a software artifact …can not be measured directly (such as software size). … is an extrinsic property which results from interdependency of the software to be tested and the test goals, test methods used, and test resources (i.e., the test context)

Lack of testability is bad. Why? A lower degree of testability results in increased test effort. In extreme cases a lack of testability may hinder testing parts of the software or software requirements at all.

Background properties of the software requirements properties of the software itself (such as size, complexity and testability) properties of the test methods used properties of the development- and testing processes qualification and motivation of the persons involved in the test process

Testability of Software Components Controllability Observability Isolateability Separation of concerns Understandability Automatability Heterogeneity

Controllability The degree to which it is possible to control the state of the component under test (CUT) as required for testing.

Observability The degree to which it is possible to observe (intermediate and final) test results.

Isolateability The degree to which the component under test (CUT) can be tested in isolation.

Separation of concerns The degree to which the component under test has a single, well defined responsibility.

Understandability The degree to which the component under test is documented or self-explaining.

Automatability The degree to which it is possible to automate testing of the component under test.

Heterogeneity The degree to which the use of diverse technologies requires to use diverse test methods and tools in parallel.

Testability of Requirements Requirements need to fulfill the following criteria in order to be testable: –consistent –complete –unambiguous –quantitative –verifiable in practice

Improving software testability Test-driven development design for testability (similar to design for test in the hardware domain)

So which system is “testable system”? Roy Osherove: “For each logical part of the system, a unit test can be written relatively easily and quickly that satisfies all the following PC-COF rules at the same time: –Partial runs are possible –Consistent results on every test run –Configuration is unneeded before run –Order of tests does not matter –Fast run time”

Consistent results on every test run The test always has to fail or pass, but never switches between modes until a bug is fixed.

What’s the problem with this code? public bool CanPurchase(Person p){ if (!(PersonValidator.IsValid(p))){ return false; } if (p.SSID != null && p.SubscriptionType != "Canceled" && p.CreditOnFile > 0){ return true; } return false; }

Interfaces make code more testable IValidator m_validator; public void SetValidator(IValidator validator) { m_validator = validator; } public bool CanPurchase(Person p) { if (!(m_validator.IsValid(p))) { return false; } if (p.SSID != null && p.SubscriptionType != "Canceled" && p.CreditOnFile > 0) { return true; } return false; } MyFakeValidator val = new MyFakeValidator(); val.whatToReturn = true; PersonLogic logic = new PersonLogic(); logic.SetValidator(val); Person p = new Person(); bool result = logic.CanPurchase(p); Assert.IsFalse(result);

Configuration is not needed, because… … ability to configure a class at runtime is an important one for unit tests. … if code requires external configuration before it is tested, it will take more time to create tests for that code. … it can also make the tests less manageable and not as easy to write.

What’s the problem here? public bool IsConnectionStringValid() { string connString = ConfigurationSettings.AppSettings["conString "].ToString(); //do some stuff return true; }

Use virtual method Class ConnectionHelper{ public bool IsConnectionStringValid() { string connString = getConnectionString(); //do some stuff //... return true; } protected virtual string getConnectionString(){ return ConfigurationSettings.AppSettings["conString"].ToString(); }

Derive and override it in testable class TestableConfigBasedClass myClass = new TestableConfigBasedClass(); myClass.mConnectString = "bad string"; Assert.AreEqual(false,myClass.IsConnectionStringValid()) public class TestableConfigBasedClass:ConnectionHelper { public string mConnectString; protected override string getConnectionString(){ return mConnectString; }

Fast run time In a non-testable system you would find it really hard, or really time consuming to write some of the tests against objects and make them run fast. That’s because you’d most likely have objects that do some sort of time consuming activity using their external dependencies.

What if the IsValid method… if (!(PersonValidator.IsValid(p))){ return false; } Calls a web service to do its bidding? reads rules from the database? To make it testable : Refactor the code to use interfaces, OR use a virtual method to check the validation and return a true/false result, then override it in your “testable” class.

Order of tests does not matter (Data layer problem) bool Insert(Person p) { //insert person to database } bool Delete(Person p) { //Delete person from database } most unit test frameworks cannot guarantee the order in which unit tests will be executed

Partial Runs of tests are possible When you have external state you’re likely to have a problem if you don’t run all the tests in your suite, since the external state between specific tests may need to be adjusted for the next test. This problem is solvable, but it’s not as easy as writing simple unit tests without external state The whole problem of rolling back external state is that of controlling the before and after states and making sure they are the same for each test run. If you can’t do that easily you’re either not using a testable system design, or you’re not writing a unit test.

References lity.pdf [žiūrėta ] lity.pdf [žiūrėta ] logs.asp.net/rosherove/articles/Design4Tesatbility1.aspx [žiūrėta ] logs.asp.net/rosherove/articles/Design4Tesatbility1.aspx [žiūrėta ]