First BlueJ Day Houston, 2006 Unit Testing with BlueJ Bruce Quig Deakin University.

Slides:



Advertisements
Similar presentations
Unit Testing Australian Development Centre Brisbane, Australia.
Advertisements

Computer Science 209 Testing With JUnit. Why Test? I don ’ t have time, I ’ ve got a deadline to meet The more pressure I feel, the fewer tests I will.
A Brief Introduction to Test- Driven Development Shawn M. Jones.
Test-Driven Development. Why Testing is Important? “If you don’t have tests, how do you know your code is doing the thing right and doing the right thing?”
Testing by Duncan Butler Sara Stephens. Too much to cover.
Well-behaved objects 4.0 Testing. 2 Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling Main concepts to.
Test Driven Development: An Emerging Solution for Software Development.
Production Programming in the Classroom Eric Allen, Robert Cartwright, and Charles Reis Rice University {eallen, cork,
Software Testing. “Software and Cathedrals are much the same: First we build them, then we pray!!!” -Sam Redwine, Jr.
5.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
Test-Driven Development “Test first, develop later!” –OCUnit.
Red-Green-Refactor! EclipseCon 2008 Kevin P. Taylor, Nicolaus Malnick Test-Driven Development (TDD) for Eclipse RCP.
By: Taylor Helsper.  Introduction  Test Driven Development  JUnit  Testing Private Methods  TDD Example  Conclusion.
By: Taylor Helsper.  Introduction  Test Driven Development  JUnit  TDD Example  Conclusion.
TEST-DRIVEN DEVELOPMENT AND MVP Cory Foy and Michael Russo.
Starting Chapter 4 Starting. 1 Course Outline* Covered in first half until Dr. Li takes over. JAVA and OO: Review what is Object Oriented Programming.
Lesson 7 Unit Testing /JUnit/ AUBG ICoSCIS Team Assoc. Prof. Stoyan Bonev March, , 2013 SWU, Blagoevgrad.
Behaviour Driven Development with Cucumber for Java.
Introduction to Unit Testing Jun-Ru Chang 2012/05/03.
Sumedha Rubasinghe October,2009 Introduction to Programming Tools.
Copyright 2006 Steven Feuerstein - Page 1 Six Simple Steps to Unit Testing Happiness Steven Feuerstein
Or ways to enhance coding enjoyment, productivity and, most of all, preserve your sanity. Nicolas Connault Web developer Moodle HQ February 19 th 2008.
5.0 Objects First with Java A Practical Introduction using BlueJ Introduction to Computer Science I Instructor: Allyson Anderson.
Cory Foy St. Louis Code Camp May 6 th, 2005 Achieving Customer Zen with Fitnesse and.NET Fitnesse and.NET Achieving Customer.
1 SEG4912 University of Ottawa by Jason Kealey Software Engineering Capstone Project Tools and Technologies.
Software Engineering 1 Object-oriented Analysis and Design Chap 21 Test-Driven Development and Refactoring.
Dr. Tom WayCSC Testing and Test-Driven Development CSC 4700 Software Engineering Based on Sommerville slides.
JavaScript Unit Testing Hanoi PHP Day
Future Media  BBC MMXI TDD at the BBC David Craddock, Jack Palfrey and Tom Canter.
Well-behaved objects Main concepts to be covered Testing Debugging Test automation Writing for maintainability Objects First with Java - A Practical.
Week81 APCS-AB: Java Unit Testing Information today from “Unit Testing in BlueJ” October 28, 2005.
Celluloid An interactive media sequencing language.
M Gallas CERN EP-SFT LCG-SPI: SW-Testing1 LCG-SPI: SW-Testing QMTest test framework LCG AppArea meeting (16/07/03) LCG/SPI LCG Software.
5.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
Week 14 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Copyright © 2005 Charlie Poole. All rights reserved Test First User Interfaces XP2005 Sheffield University June 18, 2005.
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,
OOPDA Intro 5.0. Topics Website and Syllabus Rowan VPN and H:drive BlueJ application and projects Programming Style (Appendix J) Javadoc (Appendix I)
1First BlueJ Day, Houston, Texas, 1st March 2006 Debugging in BlueJ Davin McCall.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Testing Spring Applications Unit Testing.
Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping.
Objects First With Java A Practical Introduction Using BlueJ Well-behaved objects 2.1.
1 COS 260 DAY 15 Tony Gauvin. 2 Agenda Questions? 6 th Mini quiz Today –Chapter 6 Assignment 4 posted –Due Nov 9 Capstone progress reports are due –Brief.
CS-2852 Data Structures LECTURE 7B Andrew J. Wozniewicz Image copyright © 2010 andyjphoto.com.
Unit Testing. F-22 Raptor Fighter Manufactured by Lockheed Martin & Boeing How many parts does the F-22 have?
Well-behaved objects Main concepts to be covered Testing Debugging Test automation Writing for maintainability Objects First with Java - A Practical.
Test Driven Development Introduction Issued date: 8/29/2007 Author: Nguyen Phuc Hai.
Testing JUnit Testing. Testing Testing can mean many different things It certainly includes running a completed program with various inputs It also includes.
JUnit Testing Why we do this and how we can get better.
Unit testing with NUnit Anne Lam & Chris James CMPS 4113 – Software Engineering April 15, 2015.
6.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
Software Engineering Lecture 11 Software Testing Presenter: Josef Hallberg 1.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Well-behaved objects Main concepts to be covered Testing Debugging Test automation Writing for maintainability © 2017 Pearson Education, Inc. Hoboken,
Getting Started with JUnit Getting Started with JUnit The benefits and ease of writing and running JUnit test cases and test suites. The benefits and ease.
SWE 434 SOFTWARE TESTING AND VALIDATION LAB2 – INTRODUCTION TO JUNIT 1 SWE 434 Lab.
Automated Software Testing
Unit Testing.
Objects First with Java A Practical Introduction using BlueJ
Introduction to JUnit CS 4501 / 6501 Software Testing
WeBWorK Java Evaluator
Test Driven Development 1 November Agenda  What is TDD ?  Steps to start  Refactoring  TDD terminology  Benefits  JUnit  Mocktio  Continuous.
COS 260 DAY 17 Tony Gauvin.
COS 260 DAY 16 Tony Gauvin.
Testing and Test-Driven Development CSC 4700 Software Engineering
Introduction to JUnit CS 4501 / 6501 Software Testing
Objects First with Java A Practical Introduction using BlueJ
CS 240 – Advanced Programming Concepts
Objects First with Java A Practical Introduction using BlueJ
Java & Testing.
Presentation transcript:

First BlueJ Day Houston, 2006 Unit Testing with BlueJ Bruce Quig Deakin University

2 First BlueJ Day, Houston, Texas, 1st March 2006 Outline Introduction Interactive Testing in BlueJ Testing in JUnit Integrating JUnit and BlueJ Demo Questions

3 First BlueJ Day, Houston, Texas, 1st March 2006 Introduction Testing is important Introducing testing in first year is hard because –Hard to motivate students to test –Time intensive to do regression testing without support Our contention –Tool support can make it easier to introduce testing into first year curricula

4 First BlueJ Day, Houston, Texas, 1st March 2006 Testing in BlueJ Good support for ad-hoc testing –Write code –Construct objects on object bench –Execute methods on objects –Look at the results Immediate feedback after implementation One problem –Tests must be redone by hand –Not good for regression testing (unless patient!)

5 First BlueJ Day, Houston, Texas, 1st March 2006 Testing in JUnit Hugely popular framework for performing unit testing in Java Has similar versions for almost every programming language NUnit, PyUnit etc Simple in concept –Each method in the test class starting with test is run independently of all other test methods –Each assertXXX call in the method is evaluated and if one fails, the test method fails –Test class is regular Java Supports Test-Driven Development (TDD)

6 First BlueJ Day, Houston, Texas, 1st March 2006 A sample JUnit test class class PersonTest extends TestCase { public void testSetName() { Person mik = new Person(); mik.setName(”Michael"); assertEquals(”Michael", mik.getName()); }

7 First BlueJ Day, Houston, Texas, 1st March 2006 Integrating JUnit with BlueJ Goals –Support for writing of standard JUnit test classes, including test-driven development (TDD), for regression testing –Support JUnit source files in BlueJ –Combination of JUnit and BlueJ testing: Recording of user interactions for easy creation of test methods

8 First BlueJ Day, Houston, Texas, 1st March 2006 Integrating JUnit with BlueJ Our approach –Use the interaction techniques in BlueJ to construct JUnit unit tests

9 First BlueJ Day, Houston, Texas, 1st March 2006 Demo

10 First BlueJ Day, Houston, Texas, 1st March 2006 Teaching goals How to create good tests Encourage students to test Knowledge about Test Driven Development Some important problems: –Testing can be boring and seem pointless –Takes time (away from “real” programming)

11 First BlueJ Day, Houston, Texas, 1st March 2006 How to create good tests Positive testing EXAMPLE Negative testing EXAMPLE Boundary tests EXAMPLE Bug tests

12 First BlueJ Day, Houston, Texas, 1st March 2006 Encourage testing Show the benefits of testing: –Automated tests finds bugs as program is developed. –In BlueJ it is easy to create tests. –Sense of achievement when test passes. –Try to design exercises that include non- trivial bugs. –Give them implementation exercises that are likely to make previously created tests fail.

13 First BlueJ Day, Houston, Texas, 1st March 2006 Test Driven Development Testing before implementation. Makes you think about interface before implementation. Popular in agile development processes like eXtreme Programming. Advanced concept that is difficult to do from the very start of a course because it requires : –the method definitions to exist OR –the ability to manually write test

14 First BlueJ Day, Houston, Texas, 1st March 2006 How to design an exercise Give students a program with bugs –Non-trivial bugs. (String equality, if(…);{…}) –Have bugs that can be found with positive, negative and boundary tests. Make students write test cases that exposes the bugs. Fix bugs Rerun tests