Lecture 6 Software Testing and jUnit CS140 Dick Steflik.

Slides:



Advertisements
Similar presentations
Software Testing. Quality is Hard to Pin Down Concise, clear definition is elusive Not easily quantifiable Many things to many people You'll know it when.
Advertisements

Testing and Quality Assurance
1 Software Engineering Lecture 11 Software Testing.
JUnit. What is unit testing? A unit is the smallest testable part of an application. A unit test automatically verifies the correctness of the unit. There.
Unit 251 Implementation and Integration Implementation Unit Testing Integration Integration Approaches.
JUnit. Why is testing good? Due to psychological factors, programmers are bad testers. A computer can test much faster than a human Philosophy: “If it.
Program Testing Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
Automated Testing Nathan Weiss April 23, Overview History of Testing Advantages to Automated Testing Types of Automated Testing Automated Testing.
 What is Software Testing  Terminologies used in Software testing  Types of Testing  What is Manual Testing  Types of Manual Testing  Process that.
Test Design Techniques
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
© Dr. A. Williams, Fall Present Software Quality Assurance – JUnit Lab 1 JUnit A unit test framework for Java –Authors: Erich Gamma, Kent Beck Objective:
BY: GARIMA GUPTA MCA FINAL YEAR WHAT IS SOFTWARE TESTING ? SOFTWARE TESTING IS THE PROCESS OF EXECUTING PROGRAMS OR SYSTEM WITH THE INTENT.
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
Introduction to Unit Testing Jun-Ru Chang 2012/05/03.
Software Testing. Definition To test a program is to try to make it fail.
TESTING.
Testing.
Objectives Understand the basic concepts and definitions relating to testing, like error, fault, failure, test case, test suite, test harness. Explore.
© 2012 IBM Corporation Rational Insight | Back to Basis Series Chao Zhang Unit Testing.
Principles of Object Oriented Programming Practical session 2 – part A.
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
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.
Testing in Extreme Programming
Lecture 11 Testing and Debugging SFDV Principles of Information Systems.
Software Testing. What is Software Testing? Definition: 1.is an investigation conducted to provide stakeholders with information about the quality of.
16 October Reminder Types of Testing: Purpose  Functional testing  Usability testing  Conformance testing  Performance testing  Acceptance.
(1) Unit Testing and Test Planning CS2110: SW Development Methods These slides design for use in lab. They supplement more complete slides used in lecture.
JUnit Adam Heath. What is JUnit?  JUnit is a unit testing framework for the Java programming language  It allows developers to swiftly and easily test.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
JUnit Don Braffitt Updated: 10-Jun-2011.
CPSC 873 John D. McGregor Session 9 Testing Vocabulary.
Chapter 1: Fundamental of Testing Systems Testing & Evaluation (MNN1063)
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 11, Testing.
LOGO TESTING Team 8: 1.Nguyễn Hoàng Khánh 2.Dương Quốc Việt 3.Trang Thế Vinh.
1 Unit Testing with JUnit CS 3331 JUnit website at Kent Beck and Eric Gamma. Test Infected: Programmers Love Writing Tests, Java Report,
CPSC 871 John D. McGregor Module 8 Session 1 Testing.
Software Quality Assurance and Testing Fazal Rehman Shamil.
CS-2852 Data Structures LECTURE 7B Andrew J. Wozniewicz Image copyright © 2010 andyjphoto.com.
Rekayasa Perangkat Lunak Sesi 14 Software Testing.
Unit Testing. F-22 Raptor Fighter Manufactured by Lockheed Martin & Boeing How many parts does the F-22 have?
 Software Testing Software Testing  Characteristics of Testable Software Characteristics of Testable Software  A Testing Life Cycle A Testing Life.
Dynamic Testing.
HNDIT23082 Lecture 09:Software Testing. Validations and Verification Validation and verification ( V & V ) is the name given to the checking and analysis.
1 Phase Testing. Janice Regan, For each group of units Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine.
Lecturer: Eng. Mohamed Adam Isak PH.D Researcher in CS M.Sc. and B.Sc. of Information Technology Engineering, Lecturer in University of Somalia and Mogadishu.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
CPSC 372 John D. McGregor Module 8 Session 1 Testing.
Subject Name: Software Testing Subject Code: 10CS842 Prepared By:
Software Testing.
SOFTWARE TESTING Date: 29-Dec-2016 By: Ram Karthick.
Software Construction Lab 10 Unit Testing with JUnit
Don Braffitt Updated: 26-Mar-2013
Unit Testing with JUnit
PREPARED BY G.VIJAYA KUMAR ASST.PROFESSOR
Testing Verification and the Joy of Breaking Code
Testing Tutorial 7.
Rekayasa Perangkat Lunak Part-13
John D. McGregor Session 9 Testing Vocabulary
TQS - Teste e Qualidade de Software (Software Testing and Quality) Introduction To Software Testing Concepts João Pascoal.
Verification and Testing
Software engineering – 1
John D. McGregor Session 9 Testing Vocabulary
John D. McGregor Session 9 Testing Vocabulary
History, Characteristics and Frameworks
Introduction to Testing, SUnit and Error Handling
Java & Testing.
Principles of Object Oriented Programming
Presentation transcript:

Lecture 6 Software Testing and jUnit CS140 Dick Steflik

Definition Software testing can be stated as the process of validating and verifying that a computer program/application/product: – meets the requirements that guided its design and development, – works as expected – can be implemented with the same characteristics – and satisfies the needs of stakeholders.

Motivation a study by NIST in 2002 reports that software bugs cost the US economy $59.5 billion annually In a study by Cambridge UK, Judge Business School the global cost is $312 billion

It is commonly believed that the earlier a defect is found, the cheaper it is to fix it. The following table shows the cost of fixing the defect depending on the stage it was found. [11] For example, if a problem in the requirements is found only post- release, then it would cost 10–100 times more to fix than if it had already been found by the requirements review. [11] 11. McConnell, Steve (2004). Code Complete (2nd ed.). Microsoft Press. p. 29. ISBN ISBN

Testing Methods Static Testing – reviews, walkthroughs, inspections Dynamic – methodologies that actually use / run the code White Box Testing – testing the internal structures of the software rather than the functionality exposed to the end user Black Box Testing – tester has no knowledge of how the software works (black box) and only applies inputs and checks outputs Gray Box Testing – involves having knowledge of internal data structures and algorithms for purposes of designing tests, while executing those tests at the user, or black-box level. The tester is not required to have full access to the software's source code

Testing Levels Unit Testing – component testing. In OO environments (C++, Java, Eiffle) this usually the class level. Integration Testing – Testing to verify the interfaces between components against a software design System Testing – testing a completely integrated system to verify it meets its requirements Acceptance Testing – Testing by the customer at delivery time.

Unit Test Usually done by the developers while they are developing the software Can involve both static and dynamic methods By keeping automated testing code, programmers can verify that they haven't broken something along the way. Software to manage these tests are often called code-driven testing frameworks.

xUnit Unit testing framework developed by Kent Beck for the Smalltalk language originally known as Sunit (1998) Ported to Java as JUnit and C and C++ as CppUnit

xUnit Architecture All xUnit Frameworks share a commmon architecture Test Runner - is an executable program that runs tests implemented using an xUnit framework and reports the test results Test case - is the most elemental class. All unit tests are inherited from here Test fixture - the set of preconditions or state needed to run a test. The developer should set up a known good state before the tests, and return to the original state after the tests Test suites - a set of tests that all share the same fixture. The order of the tests shouldn't matter Test execution – test setup, test run, test tear down Test formatter – formats the test outputs into useable format Assertions - a function or macro that verifies the behavior (or the state) of the unit under test. Usually an assertion expresses a logical condition that is true for results expected in a correctly running system under test (SUT). Failure of an assertion typically throws an exception, aborting the execution of the current test.

Sample Junit Fixture import org.junit.*; public class public static void setUpClass() throws Exception { // Code executed before the first test public void setUp() throws Exception { // Code executed before each test public void testOneThing() { // Code that tests one thing public void testAnotherThing() { // Code that tests another thing public void testSomethingElse() { // Code that tests something else public void tearDown() throws Exception { // Code executed after each test public static void tearDownClass() throws Exception { // Code executed after the last test method } }

References