Test Granularities Unit Testing and Automation

Slides:



Advertisements
Similar presentations
Making the System Operational
Advertisements

Testing Workflow Purpose
SPL/2010 Test-Driven Development (TDD) 1. SPL/
SOFTWARE TESTING. Software Testing Principles Types of software tests Test planning Test Development Test Execution and Reporting Test tools and Methods.
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
Software Quality Assurance Plan
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
Documentation Testing
Software Testing and Quality Assurance
Program Testing Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Illinois Institute of Technology
Testing - an Overview September 10, What is it, Why do it? Testing is a set of activities aimed at validating that an attribute or capability.
 QUALITY ASSURANCE:  QA is defined as a procedure or set of procedures intended to ensure that a product or service under development (before work is.
Introduction to Software Testing
Terms: Test (Case) vs. Test Suite
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
12.
Dr Andy Brooks1 FOR0383 Software Quality Assurance Lecture 1 Introduction Forkröfur/prerequisite: FOR0283 Programming II Website:
TESTING.
SOFTWARE TESTING STRATEGIES CIS518001VA : ADVANCED SOFTWARE ENGINEERING TERM PAPER.
Software Testing Life Cycle
Software Systems Verification and Validation Laboratory Assignment 3 Integration, System, Regression, Acceptance Testing Assignment date: Lab 3 Delivery.
Understand Application Lifecycle Management
Software Testing Testing principles. Testing Testing involves operation of a system or application under controlled conditions & evaluating the results.
Testing Especially Unit Testing. V-model Wikipedia:
INT-Evry (Masters IT– Soft Eng)IntegrationTesting.1 (OO) Integration Testing What: Integration testing is a phase of software testing in which.
Software Development Software Testing. Testing Definitions There are many tests going under various names. The following is a general list to get a feel.
Testing Workflow In the Unified Process and Agile/Scrum processes.
Test Driven Development Arrange, Act, Assert… Awesome Jason Offutt Software Engineer Central Christian Church
Dr. Tom WayCSC Testing and Test-Driven Development CSC 4700 Software Engineering Based on Sommerville slides.
Chapter 13: Regression Testing Omar Meqdadi SE 3860 Lecture 13 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Introduction to Software Testing. Types of Software Testing Unit Testing Strategies – Equivalence Class Testing – Boundary Value Testing – Output Testing.
Testing 1 © Minder Chen, Source: Developing Web Applications with Microsoft Visual Basic.NET and Microsoft Visual C#.NET Testing Test plan objectives.
Software Construction Lecture 18 Software Testing.
A Practical Guide To Unit Testing John E. Boal TestDrivenDeveloper.com.
Testing, Testing & Testing - By M.D.ACHARYA QA doesn't make software but makes it better.
Software Engineering 2004 Jyrki Nummenmaa 1 BACKGROUND There is no way to generally test programs exhaustively (that is, going through all execution.
Chapter 8 Testing. Principles of Object-Oriented Testing Å Object-oriented systems are built out of two or more interrelated objects Å Determining the.
CSC 480 Software Engineering Test Planning. Test Cases and Test Plans A test case is an explicit set of instructions designed to detect a particular class.
is a validation process
1 Object-Oriented Analysis and Design with the Unified Process Figure 13-1 Implementation discipline activities.
Unit Testing. F-22 Raptor Fighter Manufactured by Lockheed Martin & Boeing How many parts does the F-22 have?
HNDIT23082 Lecture 09:Software Testing. Validations and Verification Validation and verification ( V & V ) is the name given to the checking and analysis.
Unit Testing by Jon Edgar. Structure of Presentation Structure What is Unit Testing? Worked Example Extreme Programming (XP) Implementation Limitation.
What is a software? Computer Software, or just Software, is the collection of computer programs and related data that provide the instructions telling.
Software Engineering Lecture 11 Software Testing Presenter: Josef Hallberg 1.
1 March 12, Testing William Cohen NCSU CSC 591W March 12, 2008.
Software Testing Kobla Setriakor Nyomi Faculty Intern (Programming II)
CSC 480 Software Engineering
Unit Testing.
Test-Driven Development
Testing Verification and the Joy of Breaking Code
Software Engineering (CSI 321)
Approaches to ---Testing Software
Test Driven Development
Different Types of Testing
Verification and Testing
Some Simple Definitions for Testing
Applied Software Implementation & Testing
Some Important Techniques For Regression Testing That You Must Know.
Important Software Performance Testing That Ensure High Quality Solutions.
Introduction to Software Testing
Lecture 09:Software Testing
Testing and Test-Driven Development CSC 4700 Software Engineering
Software Engineering Lecture #14.
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
CS 240 – Advanced Programming Concepts
Chapter 11: Integration- and System Testing
Overview Activities from additional UP disciplines are needed to bring a system into being Implementation Testing Deployment Configuration and change management.
Software Testing Strategies
Presentation transcript:

Test Granularities Unit Testing and Automation SENG 301

Learning Objectives By the end of this lecture, you should be able to: Identify several different scales of testing, and the goals of testing at each scale Describe and apply test doubles for unit testing Understand and execute unit testing Provide rationale for automated testing

Testing at Different Scales Scale/scope of test increases http://agile.csc.ncsu.edu/SEMaterials/BlackBox.pdf

Scale: Unit Testing Defn: Testing individual hardware or software units or groups of related units. Spec: Low-level design and/or code structure Who: Usually developer Scale: A class or a component e.g. Does my abs() function work?

Scale: Integration Testing Defn: software components, hardware components, or both are combined and tested to evaluate the interaction between them Spec: Low and high-level design Who: Developers Scale: Ensuring the interfaces between classes work e.g. Mars lander (metric vs. English measurements); messages/function calls between components

Scale: Functional and System Testing Defn: Functional testing ensures that the functionality meets that which is specified in the requirement spec. System testing ensures that the system works in the larger integrated environment. Spec: High-level design, requirements spec Who: Testers (independent) Scale: entire system! e.g. stress testing, performance testing e.g. POS cash registers running in a room to stress hardware and server (e.g. price lookups) Ideally: working from a use case model

Scale: Acceptance Testing Defn: Formal testing with client to see if system satisfies acceptance criteria Spec: Requirements spec Who: Client Scale: Whole system e.g. Telephone booking system for cab company – doing this AT the cab company

Scale: Beta Testing Defn: Release of “draft” software to wide population outside of dev organization Who: “Wider” population Scale: Whole system (incl installer!) e.g. beta-tests of games Low cost Unexpected errors Lack of systematic testing Low quality error reports

(Not Scale): Regression Testing Defn: Retesting system/components to ensure modifications have not introduced unintended negative effects, and still comply with requirements Note: Not a scale thing

Terminology: Test Doubles Tests often make use of drivers, which is testing code that “drives” the test on a certain module. At the outset of A1, ScriptProcessor was a driver of the VendingMachineFactory module (which made use of other functions and modules). At the outset of A1, VendingMachineFactory was a stub--a simple implementation of the IVendingMachineFactory interface, and had hardcoded, meaningless values.

Terminology: Test Doubles In the “hints” section of A1, I suggested making a DummyVendingMachineFactory that would simply indicate when functions were called by the driver. This kind of implementation is called a fake or a test spy. When testing code, you can develop drivers that test smaller units of functionality (e.g. to ensure that the PopCan implementation is correct). When pieces of code aren’t ready, you can write stubs to help.

Unit Testing Lots of packages to help you with this (e.g. jUnit, nUnit, xUnit, blah blah blah) For this class, we will use Visual Studio’s integrated unit testing The TA will walk you through doing this in tutorial You’ll be doing this for A3! (woohoo!)

Unit Testing (briefly) Write a “test class” that drives methods on module being tested Give it “expected values”, and see whether things check out [TestClass] public class CoinRackTester { [TestMethod] public void TestInsertTwoValidCoins() { CoinRack cr = new CoinRack(new int[] { 0.25, 0.10 }); cr.Insert(new Coin(0.25)); cr.Insert(new Coin(0.10)); double expectedValue = 0.35; Assert.Equals(expectedValue, cr.TotalCoinValue, 0.001, “Coin rack not totalling properly”); }

Unit Testing (briefly) Write a “test class” that drives methods on module being tested Give it “expected values”, and see whether things check out [TestClass] public class CoinRackTester { [TestMethod] public void TestInsertTwoValidCoins() { CoinRack cr = new CoinRack(new int[] { 0.25, 0.10 }); cr.Insert(new Coin(0.25)); cr.Insert(new Coin(0.10)); double expectedValue = 0.32; Assert.Equals(expectedValue, cr.TotalCoinValue, 0.001, “Coin rack not totalling properly”); } Sometimes a test fails. This will be either because: (1) the code is broken, (2) your test is broken!!

Unit Testing (briefly) You can also make it expect Exceptions [TestClass] public class CoinRackTester { [TestMethod] public void TestInsertInvalidCoin() { CoinRack cr = new CoinRack(new int[] { 0.25, 0.10 }); try { cr.Insert(new Coin(0.30)); } catch (Exception e) { StringAssert.Contains(e.Message, “Invalid coin type”); return; Assert.Fail(“No exception thrown.”);

Automated Testing During and after bug fixing, tests must be run repeatedly After a modification, previously passing test cases may now fail (called a regression) Manual tests are tedious, and not likely to be performed consistently Mozilla’s test suite: https://developer.mozilla.org/en- US/docs/Mozilla/QA/Automated_testing Challenge: Not all tests can be automated (e.g. tests requiring physical interactions)

Learning Objectives By the end of this lecture, you should be able to: Identify several different scales of testing, and the goals of testing at each scale Describe and apply test doubles for unit testing Understand and execute unit testing Provide rationale for automated testing