CS410J: Advanced Java Programming Testing the Extreme Programming Extreme Objects

Size: px
Start display at page:

Download "CS410J: Advanced Java Programming Testing the Extreme Programming Extreme Objects"

Transcription

1 CS410J: Advanced Java Programming Testing is one of the most, if not the most, important tasks of software engineering. When software is well-tested, it is easier to document, understand, and extend. JUnit provides a flexible and easy-to-use framework for developing unit tests for Java programs. Unit Testing Java Programs with JUnit Why test your code? Using JUnit Advanced assertions with Hamcrest Testing Everybody knows that they should test their code, but why don t they? There s not enough time! However, the less you test, the less confidence you have in your code How do you know it really works? Break the vicious cycle of untested code! Don t wait until you think your code is finished to write tests Write tests as you code Copyright c by David M. Whitlock. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and full citation on the first page. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific permission and/or fee. Request permission to publish from whitlock@cs.pdx.edu. Last updated March 6, Every new piece of functionality should have a test ( unit test ) Run your tests every time you recompile 2 Extreme Programming Starting in the mid-1990s, Kent Beck and friends began evangelizing the concept of extreme programming Software needs to be developed quickly and needs to evolve even faster Software engineers should develop together: Pair Programming Testing code should be developed along with the code being tested It takes a village to write software: architect, programmer, manager, and customer Constant feedback from the customer ensures that the customer always gets what he wants The software must function, and function correctly, at all times, even if the functionality is limited Extreme Programming emphasizes simplicity and elegance in software engineering Get things working, then optimize Extreme Objects Extreme Programming works very well when developing Object-Oriented software Classes are extended to add functionality New tests are added for the new functionality The old tests for the old functionality still work Just like documenting as you code, testing as you code has many benefits You can feel confident that you code works You find bugs in your code before someone else does! You become a consumer of your own code (Is it easy to use?) If you run all of your tests every time you build, you know that your changes haven t broken anything 3 4

2 JUnit Kent Beck and Erich Gamma (of Design Patterns fame) developed a unit testing framework for Java programs called JUnit The junit.framework package contains a simple class hierarchy for developing unit tests: Assert Configuring tests with annotations JUnit was very successful, but some things in the framework were awkward Subclassing TestCase meant that your test couldn t subclass any other class test method naming convention made it difficult to locate test methods JUnit 4.0 introduced annotations in the org.junit package for marking test code asserttrue(boolean) assertequals(object, Object) fail(string) Test run(testresult) for test methods Can have an expected exception and a timeout in milliseconds TestCase TestCase(String testname) setup() teardown() * TestSuite TestSuite(Class testclass) addtest(test) addtestsuite(class for setup methods for tear down for class-level setup ad tear down methods Test code subclasses TestCase and test methods are public, return void, and have names that begin with test for methods that shouldn t be run Static import for Assert methods 6 Example Classes To demonstrate writing unit tests, we are going to develop some classes for modeling Students that are enrolled in a Section of a Course Course String department int number int credits * int term int year Section addstudent(student) dropstudent(student) double averagegrade() int getclasssize() * * Student String id Map grades Writing a simple TestCase The below class tests that adding a Student increases the enrollment by one import org.junit.test; import static org.junit.assert.assertequals; import static org.junit.assert.fail; public class SectionTest { public void testaddstudent() { Student student = new Student(" "); Course course = new Course("CS", 410, 4); Section section = new Section(course, Section.SPRING, 2001); section.addstudent(student); assertequals(1, section.getclasssize()); The assertequals method is imported from the Assert class. If its arguments are not equal, then the test fails. 7 8

3 Running The Test Case The org.junit.runner.junitcore class runs the tests in a test class and prints out the result to standard out import org.junit.runner.junitcore; import org.junit.runner.runwith; CourseTest.class) public class AllTests { public static void main(string[] args) { JUnitCore.runClasses(AllTests.class); This class defines a suite of tests that run together $ java edu.pdx.cs410j.junit.alltests Testing Error Conditions Making sure that your program fails in a well-understood fashion is very important To test that the dropstudent method throws an IllegalArgumentException when you attempt to drop a student that isn t enrolled: (expected = IllegalArgumentException.class) public void testdropstudentnotenrolled() { Student student = new Student(" "); Course course = new Course("CS", 410, 4); Section section = new Section(course, Section.SPRING, 2001); section.dropstudent(student); The fail method is statically imported from Assert and causes the test to fail If some other problem occurs while the test is running (e.g. an uncaught exception), the test fails with an error. Remember that examples.jar and junit.jar must be on the classpath 9 10 The Assert class The Assert contains methods for validating that certain conditions are true assertequals: Two entities (objects, ints, etc.) should be equal (compares objects using equals()) assertnotnull: A value should not be null assertsame: Two object references should be the same (compare objects using ==) asserttrue: A boolean expression should be true fail: The test should fail When an assertion evaluates to false, the test fails Your test class Test code is just a regular Java class with methods Methods annotated methods are invoked before and after the test is run Establish/disconnect network resources, etc. Each of your test methods must be annotated with The TestSuite class Annotating a class specifies a suite of multiple test classes You ll also need to annotate the class to tell the JUnit runner that it is a suite Each assert method is overloaded to have a String message associated with it assertequals("wrong number of students", 1, section.getclasssize()); 11 12

4 Test Classes and Packages Should test classes be in the same package as the code they are testing? Pros: Test code can access package-protected methods and fields Easy to associate test code with domain code Cons: Don t want to test code to interfere with domain code More readable assertions JUnit provides some basic methods for validating the state of your tests (assertions), but the code and the failure messages can be hard to read asserttrue(mystring.contains("hello")); When the above fails, all you get is an expected true, but got false error message The Hamcrest library provides powerful matchers that provide readable assertion statements with detailed and specific failure messages Don t want to ship test code When I write JUnit tests, I often have a separate directory hierarchy for the test code: ~/tests/edu/pdx/cs410j/ Hamcrest assertion statements Hamcrest provides an assertthat method that asserts that some value matches a matcher Each matcher has a static factory method Matchers are composed to form complex assertions The is matcher is syntactic sugar that aids readability import org.junit.test; import static org.hamcrest.matchers.*; import static org.hamcrest.matcherassert.assertthat; public class HamcrestMatchersTest { Examples of Hamcrest assertions public void isnullvalue() { assertthat(null, is(nullvalue())); public void issameinstance() { Object o = new Object(); assertthat(o, is(sameinstance(o))); public void strings() { String s = "Hamcrest is awesome"; assertthat(s, startswith("hamcrest")); assertthat(s, endswith("awesome")); assertthat(s, containsstring("is")); assertthat(s, is(not(isemptystring()))); assertthat(s, is(equaltoignoringcase("hamcrest IS public void isequalto() { Integer int1 = new Integer("123"); Integer int2 = new Integer("123"); assertthat(int1, is(equalto(int2))); 15 16

5 Examples of Hamcrest assertions Summary Testing is a good thing! public void everyitemisnotnull() { List<String> list = Arrays.asList("a", "b", "c"); assertthat(list, Improves the quality of your software everyitem(is(notnullvalue(string.class)))); public void numbers() { double pi = ; assertthat(pi, is(greaterthan(2.0))); assertthat(pi, is(both(greaterthan(1.0)). and(lessthan(4.0)))); assertthat(pi, is(closeto(3.14, 0.01))); public void arrays() { Integer[] array = { 1, 2, 3, 4, 5; assertthat(array, hasiteminarray(4)); assertthat(array, is(arraywithsize(5))); assertthat(array, is(not(emptyarray()))); assertthat(4, isin(array)); Demonstrates that your software works as specified Test as you code Write your tests first (Test-Driven Development) When you make changes, you can verify that you didn t break anything Spending time writing tests reducing debugging time JUnit makes it easy to write and run test cases Testing will help you get an A in this course! 17 18

Java Unit testing with JUnit 4.x in Eclipse

Java Unit testing with JUnit 4.x in Eclipse Lars Vogel Version 0.2 Copyright 2007 Lars Vogel 30.06.2007 Abstract This article gives a short overview of JUnit 4.x and its usage within Eclipse. You should be able to run tests

More information

Unit Testing. and. JUnit

Unit Testing. and. JUnit Unit Testing and JUnit Problem area Code components must be tested! Confirms that your code works Components must be tested t in isolation A functional test can tell you that a bug exists in the implementation

More information

Unit Testing JUnit and Clover

Unit Testing JUnit and Clover 1 Unit Testing JUnit and Clover Software Component Technology Agenda for Today 2 1. Testing 2. Main Concepts 3. Unit Testing JUnit 4. Test Evaluation Clover 5. Reference Software Testing 3 Goal: find many

More information

Unit Testing and JUnit

Unit Testing and JUnit Unit Testing and JUnit Testing Objectives Tests intended to find errors Errors should be found quickly Good test cases have high p for finding a yet undiscovered error Successful tests cause program failure,

More information

Effective unit testing with JUnit

Effective unit testing with JUnit Effective unit testing with JUnit written by Eric M. Burke burke_e@ociweb.com Copyright 2000, Eric M. Burke and All rights reserved last revised 12 Oct 2000 extreme Testing 1 What is extreme Programming

More information

+ Introduction to JUnit. IT323 Software Engineering II By: Mashael Al-Duwais

+ Introduction to JUnit. IT323 Software Engineering II By: Mashael Al-Duwais 1 + Introduction to JUnit IT323 Software Engineering II By: Mashael Al-Duwais + What is Unit Testing? 2 A procedure to validate individual units of Source Code Example: A procedure, method or class Validating

More information

JUnit Automated Software Testing Framework. Jeff Offutt. SWE 437 George Mason University 2008. Thanks in part to Aynur Abdurazik. What is JUnit?

JUnit Automated Software Testing Framework. Jeff Offutt. SWE 437 George Mason University 2008. Thanks in part to Aynur Abdurazik. What is JUnit? JUnit Automated Software Testing Framework Jeff Offutt SWE 437 George Mason University 2008 Thanks in part to Aynur Abdurazik What is JUnit? Open source Java testing framework used to write and run repeatable

More information

JUnit. Introduction to Unit Testing in Java

JUnit. Introduction to Unit Testing in Java JUnit Introduction to Unit Testing in Java Testing, 1 2 3 4, Testing What Does a Unit Test Test? The term unit predates the O-O era. Unit natural abstraction unit of an O-O system: class or its instantiated

More information

Licensed for viewing only. Printing is prohibited. For hard copies, please purchase from www.agileskills.org

Licensed for viewing only. Printing is prohibited. For hard copies, please purchase from www.agileskills.org Unit Test 301 CHAPTER 12Unit Test Unit test Suppose that you are writing a CourseCatalog class to record the information of some courses: class CourseCatalog { CourseCatalog() { void add(course course)

More information

Java. Java. e=mc 2. composition

Java. Java. e=mc 2. composition 2 Java Java e=mc 2 composition 17 18 method Extreme Programming Bo Diddley 2-1 2-1 50 1998 19 π ª º pattern XML XML hash table key/value XML 20 EJB CMP SQL ASP VBScript Microsoft ASP ASP.NET JavaScript

More information

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division CS 61B Fall 2014 P. N. Hilfinger Unit Testing with JUnit 1 The Basics JUnit is a testing framework

More information

Using JUnit in SAP NetWeaver Developer Studio

Using JUnit in SAP NetWeaver Developer Studio Using JUnit in SAP NetWeaver Developer Studio Applies to: This article applies to SAP NetWeaver Developer Studio and JUnit. Summary Test-driven development helps us meet your deadlines by eliminating debugging

More information

JUnit - A Whole Lot of Testing Going On

JUnit - A Whole Lot of Testing Going On JUnit - A Whole Lot of Testing Going On Advanced Topics in Java Khalid Azim Mughal khalid@ii.uib.no http://www.ii.uib.no/~khalid Version date: 2006-09-04 ATIJ JUnit - A Whole Lot of Testing Going On 1/51

More information

Approach of Unit testing with the help of JUnit

Approach of Unit testing with the help of JUnit Approach of Unit testing with the help of JUnit Satish Mishra mishra@informatik.hu-berlin.de About me! Satish Mishra! Master of Electronics Science from India! Worked as Software Engineer,Project Manager,Quality

More information

Table of Contents. LESSON: The JUnit Test Tool...1. Subjects...2. Testing 123...3. What JUnit Provides...4. JUnit Concepts...5

Table of Contents. LESSON: The JUnit Test Tool...1. Subjects...2. Testing 123...3. What JUnit Provides...4. JUnit Concepts...5 Table of Contents LESSON: The JUnit Test Tool...1 Subjects...2 Testing 123...3 What JUnit Provides...4 JUnit Concepts...5 Example Testing a Queue Class...6 Example TestCase Class for Queue...7 Example

More information

Test Driven Development

Test Driven Development Software Development Best Practices Test Driven Development http://www.construx.com 1999, 2006 Software Builders Inc. All Rights Reserved. Software Development Best Practices Test Driven Development, What

More information

Jiří Tomeš. Nástroje pro vývoj a monitorování SW (NSWI026)

Jiří Tomeš. Nástroje pro vývoj a monitorování SW (NSWI026) Jiří Tomeš Nástroje pro vývoj a monitorování SW (NSWI026) Simple open source framework (one of xunit family) for creating and running unit tests in JAVA Basic information Assertion - for testing expected

More information

Unit Testing & JUnit

Unit Testing & JUnit Unit Testing & JUnit Lecture Outline Communicating your Classes Introduction to JUnit4 Selecting test cases UML Class Diagrams Rectangle height : int width : int resize(double,double) getarea(): int getperimeter():int

More information

Slides prepared by : Farzana Rahman TESTING WITH JUNIT IN ECLIPSE

Slides prepared by : Farzana Rahman TESTING WITH JUNIT IN ECLIPSE TESTING WITH JUNIT IN ECLIPSE 1 INTRODUCTION The class that you will want to test is created first so that Eclipse will be able to find that class under test when you build the test case class. The test

More information

Test Driven Development

Test Driven Development Test Driven Development Introduction Test Driven development (TDD) is a fairly recent (post 2000) design approach that originated from the Extreme Programming / Agile Methodologies design communities.

More information

Java course - IAG0040. Unit testing & Agile Software Development

Java course - IAG0040. Unit testing & Agile Software Development Java course - IAG0040 Unit testing & Agile Software Development 2011 Unit tests How to be confident that your code works? Why wait for somebody else to test your code? How to provide up-to-date examples

More information

sveltest: A testing language

sveltest: A testing language Look familiar? sveltest: A testing language Kaitlin Huben (Project Manager) Emily Hsia (Language Guru) Josh Lieberman (System Architect) Chris So (System Integrator) Mandy Swinton (Verifier and Validator)

More information

UNIT TESTING. Written by Patrick Kua Oracle Australian Development Centre Oracle Corporation

UNIT TESTING. Written by Patrick Kua Oracle Australian Development Centre Oracle Corporation UNIT TESTING Written by Patrick Kua Oracle Australian Development Centre Oracle Corporation TABLE OF CONTENTS 1 Overview..1 1.1 Document Purpose..1 1.2 Target Audience1 1.3 References.1 2 Testing..2 2.1

More information

TESTING WITH JUNIT. Lab 3 : Testing

TESTING WITH JUNIT. Lab 3 : Testing TESTING WITH JUNIT Lab 3 : Testing Overview Testing with JUnit JUnit Basics Sample Test Case How To Write a Test Case Running Tests with JUnit JUnit plug-in for NetBeans Running Tests in NetBeans Testing

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

CPSC 330 Software Engineering

CPSC 330 Software Engineering CPSC 330 Software Engineering Lecture 4: Unit ing, JUnit, and Software Development Processes Today Unit ing and JUnit Software Development Processes (as time allows) Reading Assignment Lifecycle handout

More information

Author: Sascha Wolski Sebastian Hennebrueder http://www.laliluna.de/tutorials.html Tutorials for Struts, EJB, xdoclet and eclipse.

Author: Sascha Wolski Sebastian Hennebrueder http://www.laliluna.de/tutorials.html Tutorials for Struts, EJB, xdoclet and eclipse. JUnit Testing JUnit is a simple Java testing framework to write tests for you Java application. This tutorial gives you an overview of the features of JUnit and shows a little example how you can write

More information

Fail early, fail often, succeed sooner!

Fail early, fail often, succeed sooner! Fail early, fail often, succeed sooner! Contents Beyond testing Testing levels Testing techniques TDD = fail early Automate testing = fail often Tools for testing Acceptance tests Quality Erja Nikunen

More information

Agile/Automated Testing

Agile/Automated Testing ing By automating test cases, software engineers can easily run their test cases often. In this chapter, we will explain the following Guidelines on when to automate test cases, considering the cost of

More information

Test-Driven Development

Test-Driven Development Test-Driven Development An Introduction Mattias Ståhlberg mattias.stahlberg@enea.com Debugging sucks. Testing rocks. Contents 1. What is unit testing? 2. What is test-driven development? 3. Example 4.

More information

Writing Self-testing Java Classes with SelfTest

Writing Self-testing Java Classes with SelfTest Writing Self-testing Java Classes with SelfTest Yoonsik Cheon TR #14-31 April 2014 Keywords: annotation; annotation processor; test case; unit test; Java; JUnit; SelfTest. 1998 CR Categories: D.2.3 [Software

More information

Testing, Debugging, and Verification

Testing, Debugging, and Verification Testing, Debugging, and Verification Testing, Part II Moa Johansson 10 November 2014 TDV: Testing /GU 141110 1 / 42 Admin Make sure you are registered for the course. Otherwise your marks cannot be recorded.

More information

Agile.NET Development Test-driven Development using NUnit

Agile.NET Development Test-driven Development using NUnit Agile.NET Development Test-driven Development using NUnit Jason Gorman Test-driven Development Drive the design and construction of your code on unit test at a time Write a test that the system currently

More information

JUnit Howto. Blaine Simpson

JUnit Howto. Blaine Simpson JUnit Howto Blaine Simpson JUnit Howto Blaine Simpson Published $Date: 2005/09/19 15:15:02 $ Table of Contents 1. Introduction... 1 Available formats for this document... 1 Purpose... 1 Support... 2 What

More information

Using Testing and JUnit Across The Curriculum

Using Testing and JUnit Across The Curriculum Using Testing and JUnit Across The Curriculum Michael Wick, Daniel Stevenson and Paul Wagner Department of Computer Science University of Wisconsin-Eau Claire Eau Claire, WI 54701 {wickmr, stevende, wagnerpj@uwec.edu

More information

Software Engineering. Top-Down Design. Bottom-Up Design. Software Process. Top-Down vs. Bottom-Up 13/02/2012

Software Engineering. Top-Down Design. Bottom-Up Design. Software Process. Top-Down vs. Bottom-Up 13/02/2012 CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims Lecture 7: Software Design Software Engineering The art by which we start with a problem statement and gradually

More information

Unit testing with JUnit and CPPUnit. Krzysztof Pietroszek kmpietro@swen.uwaterloo.ca

Unit testing with JUnit and CPPUnit. Krzysztof Pietroszek kmpietro@swen.uwaterloo.ca Unit testing with JUnit and CPPUnit Krzysztof Pietroszek kmpietro@swen.uwaterloo.ca Old-fashioned low-level testing Stepping through a debugger drawbacks: 1. not automatic 2. time-consuming Littering code

More information

The junit Unit Tes(ng Tool for Java

The junit Unit Tes(ng Tool for Java Java Tes(ng Tools Java Tes(ng Tools junit is a tes(ng harness for unit tes(ng. emma is a code coverage tool. The tools can be used in concert to provide statement and branch coverage reports during the

More information

Unit-testing with JML

Unit-testing with JML Métodos Formais em Engenharia de Software Unit-testing with JML José Carlos Bacelar Almeida Departamento de Informática Universidade do Minho MI/MEI 2008/2009 1 Talk Outline Unit Testing - software testing

More information

Java Interview Questions and Answers

Java Interview Questions and Answers 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java

More information

RUP. Development Process. Iterative Process (spiral) Waterfall Development Process. Agile Development Process. Well-known development processes

RUP. Development Process. Iterative Process (spiral) Waterfall Development Process. Agile Development Process. Well-known development processes Well-known development processes Development Process RUP (Rational Unified Process) (Capability Maturity Model Integration) Agile / XP (extreme Programming) Waterfall Development Process Iterative Process

More information

Continuous Integration

Continuous Integration Continuous Integration Stefan Sprenger (sprengsz@informatik.hu-berlin.de) Semesterprojekt Verteilte Echtzeitrecherche in Genomdaten 15. Dezember 2015 Motivation 2 How was software developed before CI?

More information

OVERVIEW OF TESTING FIRST

OVERVIEW OF TESTING FIRST Chapter 10 Test First Learning a New Way of Life In this chapter, you ll follow an example of writing test-first code to create a version of Conway s Game of Life. This program is a classic and you may

More information

Tutorial 7 Unit Test and Web service deployment

Tutorial 7 Unit Test and Web service deployment Tutorial 7 Unit Test and Web service deployment junit, Axis Last lecture On Software Reuse The concepts of software reuse: to use the knowledge more than once Classical software reuse techniques Component-based

More information

Tutorial for Spring DAO with JDBC

Tutorial for Spring DAO with JDBC Overview Tutorial for Spring DAO with JDBC Prepared by: Nigusse Duguma This tutorial demonstrates how to work with data access objects in the spring framework. It implements the Spring Data Access Object

More information

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007

Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 The Java Type System By now, you have seen a fair amount of Java. Time to study in more depth the foundations of the language,

More information

Testing Methodology Assignment 1 Unit testing using JUnit

Testing Methodology Assignment 1 Unit testing using JUnit Assignment 1 Unit testing using JUnit Justin Pearson Palle Raabjerg Farshid Hassani Bijarbooneh Deadline: 30 th of November Submission Instructions 1. You are expected to work in pairs. 2. To pass the

More information

Jemmy tutorial. Introduction to Jemmy testing framework. Pawel Prokop. March 14, 2012. pawel.prokop@adfinem.net

Jemmy tutorial. Introduction to Jemmy testing framework. Pawel Prokop. March 14, 2012. pawel.prokop@adfinem.net tutorial Introduction to testing framework pawel.prokop@adfinem.net http://prokop.uek.krakow.pl March 14, 2012 Recording tests Testing frameworks Summary Manualy testing error prone slow and not efficient

More information

Java CPD (I) Frans Coenen Department of Computer Science

Java CPD (I) Frans Coenen Department of Computer Science Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials

More information

Tools for Integration Testing

Tools for Integration Testing Tools for Integration Testing What is integration ing? Unit ing is ing modules individually A software module is a self-contained element of a system Then modules need to be put together to construct the

More information

Appium mobile test automation

Appium mobile test automation Appium mobile test automation for Google Android and Apple ios Last updated: 4 January 2016 Pepgo Limited, 71-75 Shelton Street, Covent Garden, London, WC2H 9JQ, United Kingdom Contents About this document...

More information

SUnit Explained. 1. Testing and Tests. Stéphane Ducasse

SUnit Explained. 1. Testing and Tests. Stéphane Ducasse 1. SUnit Explained Stéphane Ducasse ducasse@iam.unibe.ch http://www.iam.unibe.ch/~ducasse/ Note for the reader: This article is a first draft version of the paper I would like to have. I would like to

More information

Designing with Exceptions. CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219

Designing with Exceptions. CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219 Designing with Exceptions CSE219, Computer Science III Stony Brook University http://www.cs.stonybrook.edu/~cse219 Testing vs. Debugging Testing Coding Does the code work properly YES NO 2 Debugging Testing

More information

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals 1 Recall From Last Time: Java Program import java.util.scanner; public class EggBasket { public static void main(string[]

More information

Unit Testing with FlexUnit. by John Mason mason@fusionlink.com

Unit Testing with FlexUnit. by John Mason mason@fusionlink.com Unit Testing with FlexUnit by John Mason mason@fusionlink.com So why Test? - A bad release of code or software will stick in people's minds. - Debugging code is twice as hard as writing the code in the

More information

CS 111 Classes I 1. Software Organization View to this point:

CS 111 Classes I 1. Software Organization View to this point: CS 111 Classes I 1 Software Organization View to this point: Data Objects and primitive types Primitive types operators (+, /,,*, %). int, float, double, char, boolean Memory location holds the data Objects

More information

CS 1133, LAB 2: FUNCTIONS AND TESTING http://www.cs.cornell.edu/courses/cs1133/2015fa/labs/lab02.pdf

CS 1133, LAB 2: FUNCTIONS AND TESTING http://www.cs.cornell.edu/courses/cs1133/2015fa/labs/lab02.pdf CS 1133, LAB 2: FUNCTIONS AND TESTING http://www.cs.cornell.edu/courses/cs1133/2015fa/labs/lab02.pdf First Name: Last Name: NetID: The purpose of this lab is to help you to better understand functions:

More information

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1 The Java Series Java Essentials I What is Java? Basic Language Constructs Slide 1 What is Java? A general purpose Object Oriented programming language. Created by Sun Microsystems. It s a general purpose

More information

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013

Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013 Masters programmes in Computer Science and Information Systems Object-Oriented Design and Programming Sample module entry test xxth December 2013 This sample paper has more questions than the real paper

More information

Deep Agile Blending Scrum and Extreme Programming. Jeff Sutherland Ron Jeffries

Deep Agile Blending Scrum and Extreme Programming. Jeff Sutherland Ron Jeffries Deep Agile Blending Scrum and Extreme Programming Jeff Sutherland Ron Jeffries Separation of XP and Scrum Methods * Largely Historical * XP chose to write more down * XP programmer focus * Successful Scrum

More information

Introduction to unit testing with Java, Eclipse and Subversion

Introduction to unit testing with Java, Eclipse and Subversion Introduction to unit testing with Java, Eclipse and Subversion Table of Contents 1. About Unit Tests... 2 1.1. Introduction... 2 1.2. Unit tests frameworks... 3 2. A first test class... 4 2.1. Problem

More information

Running and Testing Java EE Applications in Embedded Mode with JupEEter Framework

Running and Testing Java EE Applications in Embedded Mode with JupEEter Framework JOURNAL OF APPLIED COMPUTER SCIENCE Vol. 21 No. 1 (2013), pp. 53-69 Running and Testing Java EE Applications in Embedded Mode with JupEEter Framework Marcin Kwapisz 1 1 Technical University of Lodz Faculty

More information

SpiraTest / SpiraTeam Automated Unit Testing Integration & User Guide Inflectra Corporation

SpiraTest / SpiraTeam Automated Unit Testing Integration & User Guide Inflectra Corporation SpiraTest / SpiraTeam Automated Unit Testing Integration & User Guide Inflectra Corporation Date: October 3rd, 2014 Contents 1. Introduction... 1 2. Integrating with NUnit... 2 3. Integrating with JUnit...

More information

e ag u g an L g ter lvin v E ram Neal G g ro va P Ja

e ag u g an L g ter lvin v E ram Neal G g ro va P Ja Evolving the Java Programming Language Neal Gafter Overview The Challenge of Evolving a Language Design Principles Design Goals JDK7 and JDK8 Challenge: Evolving a Language What is it like trying to extend

More information

webmunit for WebMethods Integration Server

webmunit for WebMethods Integration Server webmunit for WebMethods Integration Server This document presents webmunit, a Unit Testing Library developed from scratch on the webmethods Integration Server platform. It also discusses the unit testing

More information

CSE 326: Data Structures. Java Generics & JUnit. Section notes, 4/10/08 slides by Hal Perkins

CSE 326: Data Structures. Java Generics & JUnit. Section notes, 4/10/08 slides by Hal Perkins CSE 326: Data Structures Java Generics & JUnit Section notes, 4/10/08 slides by Hal Perkins Type-Safe Containers Idea a class or interface can have a type parameter: public class Bag { private E item;

More information

HW3: Programming with stacks

HW3: Programming with stacks HW3: Programming with stacks Due: 12PM, Noon Thursday, September 18 Total: 20pts You may do this assignment with one other student. A team of two members must practice pair programming. Pair programming

More information

PHPUnit Manual. Sebastian Bergmann

PHPUnit Manual. Sebastian Bergmann PHPUnit Manual Sebastian Bergmann PHPUnit Manual Sebastian Bergmann Publication date Edition for PHPUnit 3.5. Updated on 2011-04-05. Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011 Sebastian Bergmann

More information

Cucumber: Finishing the Example. CSCI 5828: Foundations of Software Engineering Lecture 23 04/09/2012

Cucumber: Finishing the Example. CSCI 5828: Foundations of Software Engineering Lecture 23 04/09/2012 Cucumber: Finishing the Example CSCI 5828: Foundations of Software Engineering Lecture 23 04/09/2012 1 Goals Review the contents of Chapters 9 and 10 of the Cucumber textbook Testing Asynchronous Systems

More information

Tutorial: Getting Started

Tutorial: Getting Started 9 Tutorial: Getting Started INFRASTRUCTURE A MAKEFILE PLAIN HELLO WORLD APERIODIC HELLO WORLD PERIODIC HELLO WORLD WATCH THOSE REAL-TIME PRIORITIES THEY ARE SERIOUS SUMMARY Getting started with a new platform

More information

Capabilities of a Java Test Execution Framework by Erick Griffin

Capabilities of a Java Test Execution Framework by Erick Griffin Capabilities of a Java Test Execution Framework by Erick Griffin Here we discuss key properties and capabilities of a Java Test Execution Framework for writing and executing discrete Java tests for testing

More information

How To Test In Bluej

How To Test In Bluej Unit Testing in BlueJ Version 1.0 for BlueJ Version 1.3.0 Michael Kölling Mærsk Institute University of Southern Denmark Copyright M. Kölling 1 INTRODUCTION.........................................................................

More information

Software Engineering Techniques

Software Engineering Techniques Software Engineering Techniques Low level design issues for programming-in-the-large. Software Quality Design by contract Pre- and post conditions Class invariants Ten do Ten do nots Another type of summary

More information

Software Testing with Python

Software Testing with Python Software Testing with Python Magnus Lyckå Thinkware AB www.thinkware.se EuroPython Conference 2004 Chalmers, Göteborg, Sweden 2004, Magnus Lyckå In the next 30 minutes you should... Learn about different

More information

Java Bluetooth stack Acceptance Test Plan Version 1.0

Java Bluetooth stack Acceptance Test Plan Version 1.0 Java Bluetooth stack Acceptance Test Plan Version 1.0 Doc. No.: Revision History Date Version Description Author 2003-12-12 0.1 Initial Draft Marko Đurić 2004-01-07 0.5 Documentation updated Marko Đurić

More information

Quartz.Net Scheduler in Depth

Quartz.Net Scheduler in Depth Quartz.Net Scheduler in Depth Introduction What is a Job Scheduler? Wikipedia defines a job scheduler as: A job scheduler is a software application that is in charge of unattended background executions,

More information

Vim, Emacs, and JUnit Testing. Audience: Students in CS 331 Written by: Kathleen Lockhart, CS Tutor

Vim, Emacs, and JUnit Testing. Audience: Students in CS 331 Written by: Kathleen Lockhart, CS Tutor Vim, Emacs, and JUnit Testing Audience: Students in CS 331 Written by: Kathleen Lockhart, CS Tutor Overview Vim and Emacs are the two code editors available within the Dijkstra environment. While both

More information

15-214: Principles of Software Construction 8 th March 2012

15-214: Principles of Software Construction 8 th March 2012 15-214 Midterm Exam Andrew ID: SOLUTIONS 1 / 13 15-214: Principles of Software Construction 8 th March 2012 Name: SOLUTIONS Recitation Section (or Time): Instructions: Make sure that your exam is not missing

More information

Hands on exercise for

Hands on exercise for Hands on exercise for João Miguel Pereira 2011 0 Prerequisites, assumptions and notes Have Maven 2 installed in your computer Have Eclipse installed in your computer (Recommended: Indigo Version) I m assuming

More information

Getting Started with the Internet Communications Engine

Getting Started with the Internet Communications Engine Getting Started with the Internet Communications Engine David Vriezen April 7, 2014 Contents 1 Introduction 2 2 About Ice 2 2.1 Proxies................................. 2 3 Setting Up ICE 2 4 Slices 2

More information

The Rules 1. One level of indentation per method 2. Don t use the ELSE keyword 3. Wrap all primitives and Strings

The Rules 1. One level of indentation per method 2. Don t use the ELSE keyword 3. Wrap all primitives and Strings Object Calisthenics 9 steps to better software design today, by Jeff Bay http://www.xpteam.com/jeff/writings/objectcalisthenics.rtf http://www.pragprog.com/titles/twa/thoughtworks-anthology We ve all seen

More information

Introduction to Java

Introduction to Java Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

More information

Sharpen Solutions. 1 Part One. Sometimes there s more than one right answer. And sometimes the

Sharpen Solutions. 1 Part One. Sometimes there s more than one right answer. And sometimes the 1 Part One g h Sharpen Solutions g You didn t think we d just leave you hanging, did you? No, we thought we d be all nice and helpful with this first book, to get you hooked, and then slam you in the next

More information

CSE 308. Coding Conventions. Reference

CSE 308. Coding Conventions. Reference CSE 308 Coding Conventions Reference Java Coding Conventions googlestyleguide.googlecode.com/svn/trunk/javaguide.html Java Naming Conventions www.ibm.com/developerworks/library/ws-tipnamingconv.html 2

More information

PHPUnit Manual. Sebastian Bergmann

PHPUnit Manual. Sebastian Bergmann PHPUnit Manual Sebastian Bergmann PHPUnit Manual Sebastian Bergmann Publication date Edition for PHPUnit 3.4. Updated on 2010-09-19. Copyright 2005, 2006, 2007, 2008, 2009, 2010 Sebastian Bergmann This

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

More on Objects and Classes

More on Objects and Classes Software and Programming I More on Objects and Classes Roman Kontchakov Birkbeck, University of London Outline Object References Class Variables and Methods Packages Testing a Class Discovering Classes

More information

Integrating Formal Models into the Programming Languages Course

Integrating Formal Models into the Programming Languages Course Integrating Formal Models into the Programming Languages Course Allen B. Tucker Robert E. Noonan Computer Science Department Computer Science Department Bowdoin College College of William and Mary Brunswick,

More information

Java Web Services SDK

Java Web Services SDK Java Web Services SDK Version 1.5.1 September 2005 This manual and accompanying electronic media are proprietary products of Optimal Payments Inc. They are to be used only by licensed users of the product.

More information

How to Write AllSeen Alliance Self- Certification Test Cases September 25, 2014

How to Write AllSeen Alliance Self- Certification Test Cases September 25, 2014 How to Write AllSeen Alliance Self- Certification Test Cases September 25, 2014 This work is licensed under a Creative Commons Attribution 4.0 International License. http://creativecommons.org/licenses/by/4.0/

More information

Plugin JUnit. Contents. Mikaël Marche. November 18, 2005

Plugin JUnit. Contents. Mikaël Marche. November 18, 2005 Plugin JUnit Mikaël Marche November 18, 2005 JUnit is a Java API enabling to describe unit tests for a Java application. The JUnit plugin inside Salomé-TMF enables one to execute automatically JUnit tests

More information

Agenda. What is and Why Polymorphism? Examples of Polymorphism in Java programs 3 forms of Polymorphism

Agenda. What is and Why Polymorphism? Examples of Polymorphism in Java programs 3 forms of Polymorphism Polymorphism 1 Agenda What is and Why Polymorphism? Examples of Polymorphism in Java programs 3 forms of Polymorphism 2 What is & Why Polymorphism? 3 What is Polymorphism? Generally, polymorphism refers

More information

public static void main(string[] args) { System.out.println("hello, world"); } }

public static void main(string[] args) { System.out.println(hello, world); } } Java in 21 minutes hello world basic data types classes & objects program structure constructors garbage collection I/O exceptions Strings Hello world import java.io.*; public class hello { public static

More information

Tutorial for Creating Resources in Java - Client

Tutorial for Creating Resources in Java - Client Tutorial for Creating Resources in Java - Client Overview Overview 1. Preparation 2. Creation of Eclipse Plug-ins 2.1 The flight plugin 2.2 The plugin fragment for unit tests 3. Create an integration test

More information

ECE 122. Engineering Problem Solving with Java

ECE 122. Engineering Problem Solving with Java ECE 122 Engineering Problem Solving with Java Introduction to Electrical and Computer Engineering II Lecture 1 Course Overview Welcome! What is this class about? Java programming somewhat software somewhat

More information

Unit Testing with junit. based on materials by M. Stepp, M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia

Unit Testing with junit. based on materials by M. Stepp, M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia Unit Testing with junit based on materials by M. Stepp, M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia Bugs and testing software reliability: Probability that a software system will not cause failure

More information

An Overview of Java. overview-1

An Overview of Java. overview-1 An Overview of Java overview-1 Contents What is Java Major Java features Java virtual machine Java programming language Java class libraries (API) GUI Support in Java Networking and Threads in Java overview-2

More information

Introduction to HP ArcSight ESM Web Services APIs

Introduction to HP ArcSight ESM Web Services APIs Introduction to HP ArcSight ESM Web Services APIs Shivdev Kalambi Software Development Manager (Correlation Team) #HPProtect Agenda Overview Some applications of APIs ESM Web Services APIs Login Service

More information

Creating A Walking Skeleton

Creating A Walking Skeleton Creating A Walking Skeleton Write and Automate First Acceptance Test Automate Build and Package Automate Deploy Implement Feature Automate Static Analysis Automate Code Coverage & Integration Test 1. Add

More information