CS-2852 Data Structures LECTURE 7B Andrew J. Wozniewicz Image copyright © 2010 andyjphoto.com.

Slides:



Advertisements
Similar presentations
Test Yaodong Bi.
Advertisements

SPL/2010 Test-Driven Development (TDD) 1. SPL/
MAHDI OMAR JUNIT TUTORIAL. CONTENTS Installation of Junit Eclipse support for Junit Using Junit exercise JUnit options Questions Links and Literature.
CS-2852 Data Structures LECTURE 11 Andrew J. Wozniewicz Image copyright © 2010 andyjphoto.com.
Objectives: Test Options JUnit Testing Framework TestRunners Test Cases and Test Suites Test Fixtures JUnit.
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.
OOP #10: Correctness Fritz Henglein. Wrap-up: Types A type is a collection of objects with common behavior (operations and properties). (Abstract) types.
TDD Test-Driven Development. JUnit 4.0 To use annotations need to import org.junit.Test To use assertion need to import org.junit.Assert.* No need to.
Unit testing C# classes “If it isn’t tested it doesn’t work” Unit testing C# classes1.
15-Jul-15 JUnit. 2 Test suites Obviously you have to test your code to get it working in the first place You can do ad hoc testing (testing whatever occurs.
Software Testing & Strategies
Unit Testing with JUnit Dan Fleck Fall 2007 (For both CS211 and 421… two birds… one lecture! :-)
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
Concordia University Department of Computer Science and Software Engineering Click to edit Master title style ADVANCED PROGRAMMING PRACTICES Unit Testing.
Lecture 6 Software Testing and jUnit CS140 Dick Steflik.
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
Introduction to Unit Testing Jun-Ru Chang 2012/05/03.
Principles of Object Oriented Programming Practical session 2 – part A.
Implementation Yaodong Bi. Introduction to Implementation Purposes of Implementation – Plan the system integrations required in each iteration – Distribute.
Testing in Extreme Programming
Introduction to Testing 1. Testing  testing code is a vital part of the development process  the goal of testing is to find defects in your code  Program.
Sadegh Aliakbary Sharif University of Technology Spring 2012.
Testing Basics of Testing Presented by: Vijay.C.G – Glister Tech.
JUnit & Eclipse1 DEPARTMENT OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING CONCORDIA UNIVERSITY Feb 2, 2009 revision 1.2 – Feb 2, 2009 by Emil Vassev & Joey.
Test automation / JUnit Building automatically repeatable test suites.
CSC 395 – Software Engineering Lecture 10: Execution-based Testing –or– We can make it better than it was. Better...faster...agiler.
Software Construction Lecture 18 Software Testing.
First BlueJ Day Houston, 2006 Unit Testing with BlueJ Bruce Quig Deakin University.
CS-2852 Data Structures LECTURE 7A Andrew J. Wozniewicz Image copyright © 2010 andyjphoto.com.
Introduction to JUnit 3.8 SEG 3203 Winter ‘07 Prepared By Samia Niamatullah.
Chapter 11, Testing: Unit Testing with JUnit 4
Unit Testing with JUnit and Clover Based on material from: Daniel Amyot JUnit Web site.
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.
A tool for test-driven development
EMBEDDED REAL-TIME, INC. December 8, 2015 Java Unit Mark Mosher Rochester Java Users Group.
JUnit Don Braffitt Updated: 10-Jun-2011.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 11, Testing.
Testing code COMP204. How to? “manual” –Tedious, error-prone, not repeatable “automated” by writing code: –Assertions –Junit.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
JUnit. Introduction JUnit is an open source Java testing framework used to write and run repeatable tests JUnit is integrated with several IDEs, including.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Testing Spring Applications Unit Testing.
1 Unit Testing with JUnit CS 3331 JUnit website at Kent Beck and Eric Gamma. Test Infected: Programmers Love Writing Tests, Java Report,
JUnit in Action SECOND EDITION PETAR TAHCHIEV FELIPE LEME VINCENT MASSOL GARY GREGORY ©2011 by Manning Publications Co. All rights reserved.
2-1 By Rick Mercer with help from Kent Beck and Scott Ambler Java Review via Test Driven Development.
Unit Testing. F-22 Raptor Fighter Manufactured by Lockheed Martin & Boeing How many parts does the F-22 have?
CS-2852 Data Structures LECTURE 2 Andrew J. Wozniewicz Image copyright © 2010 andyjphoto.com.
SE 433/333 Software Testing & Quality Assurance Dennis Mumaugh, Instructor Office: CDM, Room 428 Office Hours: Tuesday, 4:00 –
Unit Testing (Lab 6) Tool Junit on Eclipse SDK By Asst.Prof.Dr. Wararat Songpan(Rungworawut) Software Testing Department of Computer Science, Faculty.
Justin Bare and Deric Pang with material from Erin Peach, Nick Carney, Vinod Rathnam, Alex Mariakakis, Krysta Yousoufian, Mike Ernst, Kellen Donohue Section.
Testing Overview Software Reliability Techniques Testing Concepts CEN 4010 Class 24 – 11/17.
Unit Testing in Eclipse Presented by David Eisler 08/09/2014.
Test automation / JUnit Building automatically repeatable test suites.
SWE 434 SOFTWARE TESTING AND VALIDATION LAB2 – INTRODUCTION TO JUNIT 1 SWE 434 Lab.
Advanced programming Practices
Unit Testing.
Software Construction Lab 10 Unit Testing with JUnit
Don Braffitt Updated: 26-Mar-2013
Unit Testing with JUnit
Introduction to JUnit CS 4501 / 6501 Software Testing
JUnit 28-Nov-18.
Introduction to JUnit CS 4501 / 6501 Software Testing
JUnit 11-Jan-19.
More JUnit CS 4501 / 6501 Software Testing
Introduction to JUnit IT323 – Software Engineering II
Section 3 Graphs & Testing
CS 240 – Advanced Programming Concepts
Section 4: Graphs and Testing
JUnit Reading: various web pages
JUnit 31-May-19.
Principles of Object Oriented Programming
Presentation transcript:

CS-2852 Data Structures LECTURE 7B Andrew J. Wozniewicz Image copyright © 2010 andyjphoto.com

CS-2852 Data Structures, Andrew J. Wozniewicz Agenda Introduction to Testing Automated Testing – JUnit Debugging

CS-2852 Data Structures, Andrew J. Wozniewicz What is Testing? The purpose of testing is to find bugs. No amount of testing “proves” correctness – impossible to test all scenarios. Process of exercising a program (or its part) under controlled conditions and verifying that the results are as expected. DEFINITION

CS-2852 Data Structures, Andrew J. Wozniewicz Classification of Testing I Unit testing – Test a single method or class. Integration testing – Test a cluster of related classes, subsystems, etc. System testing – Test the whole program, as it will be used. Acceptance testing – System testing for the benefit of the “customer”.

CS-2852 Data Structures, Andrew J. Wozniewicz Classification of Testing II Black-Box Testing – Based on public interfaces and external specs – “Functional testing” White-Box Testing – Based on the intimate knowledge of the implementation. – Exercise all/as many as possible paths of execution – “Coverage testing”

CS-2852 Data Structures, Andrew J. Wozniewicz Testing Ideas Boundary Conditions – Special cases that might cause the program to fail. Test Scaffolding – Stubs, Mockups Skeleton with minimal implementation. – Pre- and Postconditions – Driver Programs

CS-2852 Data Structures, Andrew J. Wozniewicz Unit Testing Unit Test – Code written by a developer that tests a specific functionality. – Used as part of specifying out the system (pre-code) – Used for regression testing (post-code)

CS-2852 Data Structures, Andrew J. Wozniewicz JUnit Unit Testing Framework By Kent Beck and Erich Gamma JUnit is a simple, open-source framework to write repeatable tests. Home Page: Automatic: JUnit tests do not require human judgment to interpret. Easy to set up a multitude of tests and always run them together.

CS-2852 Data Structures, Andrew J. Wozniewicz JUnit Demo

CS-2852 Data Structures, Andrew J. Wozniewicz Writing a Simple JUnit Test Step 1: Create a test class import org.junit.*; import static org.junit.Assert.*; import java.util.*; public class SimpleTest { }

CS-2852 Data Structures, Andrew J. Wozniewicz Writing a Simple JUnit Test Step 2: Write a test method (annotated ) that asserts expected results on the object under public void testEmptyCollection() { Collection collection = new ArrayList(); assertTrue(collection.isEmpty()); }

CS-2852 Data Structures, Andrew J. Wozniewicz Writing a Simple JUnit Test Step 3: Run the test from within : Run Run As... JUnit Test

CS-2852 Data Structures, Andrew J. Wozniewicz JUnit public void public void public void public void public @Test(timeout=100)

CS-2852 Data Structures, Andrew J. Wozniewicz JUnit Test Methods fail(String) assertTrue(true); assertsEquals([String message], expected, actual) assertsEquals([String message], expected, actual, tolerance) assertNull([message], object) assertNotNull([message], object) assertSame([String], expected, actual) assertNotSame([String], expected, actual) assertTrue([message], boolean condition) Equals: Values, Same: References

CS-2852 Data Structures, Andrew J. Wozniewicz Summary Introduction to Testing Automated Testing – JUnit Debugging

Questions? Image copyright © 2010 andyjphoto.com