INTRODUCTION TO JAVA PROGRAMMING JAVA FUNDAMENTALS PART 2

Size: px
Start display at page:

Download "INTRODUCTION TO JAVA PROGRAMMING JAVA FUNDAMENTALS PART 2"

Transcription

1 INTRODUCTION TO JAVA PROGRAMMING JAVA FUNDAMENTALS PART 2

2 Table of Contents Introduction to JUnit 4 What is a Test Driven approach? 5 The benefits of a Test Driven Approach 6 What is Continuous Integration? 6 What benefits does using JUnit with Continuous Integration give us? 7 JUnit Documentation 9 First Junit Test 9 Introduction to ANT 21 Ant and Continuous Integration 22 Getting Started with ANT 24 Simple ANT files 25 Multiple ANT files 35 Overview of java.util package 46 Lists 46 Arrays 48 ArrayList 48 Vectors 48 Using Collections class to synchronize lists 49 LinkedList and Deque interface 54 Maps 57 Comparable interface: 66 Deque 67 Set 71 Overview of java.io package 75 java.io.file 76 java.io.file.showuseoffile 84 Listing Files 86 Buffered Reader and Writer 89 Inputstreams 100 Overview of threads 111 Using Runnable 111

3 Overview of javax.swing package 166

4 Introduction to JUnit This section gives you an introduction to junit: * Overview of junit * Overview of Test Driven Approach * Benefits of a Test Driven Approach * Overview of Continuous Integration * Benefits of using JUnit with Continuous Integration This section has examples of code that can be found in the /junit/01_example of this section. If you would like to compile or run the code please download this examples. JUnit is a java library used for unit testing. Unit testing is used for testing small units of code. Tests need to be written to test all units of code. If all units of code are tested we have 100% code coverage. Junit is a tool used by Agile Programming. Agile Programming Methodology uses a Test Driven approach to writing code. This means that one writes tests before one writes the code. JUnit is a useful library for writing unit tests. JUnit has a test runner class that can be run from your main method. Alternatively you can set up ANT to run your JUnit tests using an Ant based runner. ANT is a build tool which uses XML configuration files. You can configure ANT to compile, package, run your junit tests and deploy your code. JUnit can be configured to produce XML reports on the tests that it runs. These XML reports can be converted to Web Pages. Agile Programming Methodology is an avid user of Continuous Integration. If JUnit is used in conjunction with tools such as Ant, Cruise Control and Subversion it becomes a useful tool for Continuous Integration.

5 What is a Test Driven approach? A Test Driven approach is one where you write your tests before you write your code. When using Junit this means that you write you Test Case class before you write any of your interfaces or implementation classes. This may seem a bit bizarre at the beginning for your Test Case will not even compile as none of the interfaces or implementation classes you are testing even exist. So the steps of a Test Driven approach are as follows: * Write your Test Case. Refer to classes and interfaces that do not already exist in your project. Code all your expected Responses. The expected responses are what you expect the implementation methods you have not written yet will return. * Write skeleton code for your interfaces and implementation classes so that your Test Case is able to compile. For example if an implementation class has a method that returns a value get it to return an empty string or null temporarily. * Now run your Test Case. Your Test Case will fail at this moment in time as your implementation methods are returning empty strings or nulls instead of the expected response. * Keep implementing your classes and re-running the unit tests until the Test Case you originally coded passes. * While implementing a class we may write pseudo code that calls another method that does not yet exist. Now is the time then to create another unit test for this method! After writing the unit test for this method, implement the method. * REMEMBER: WRITE your test BEFORE writing the implementation classes. The temptation is to write your implementation classes before you write your tests, but read on to see why writing your test before you write the implementation code is so IMPORTANT!

6 The benefits of a Test Driven Approach There are many benefits of a Test Driven Approach: It encourages 100% code coverage by JUnit tests. Remember that re-factoring the code base to make it more elegant, reusable, understandable and efficient becomes a low risk activity if there is 100% code coverage: Any accidental mistakes in the re-factoring will immediately be flagged by Continuous Integration tools such as Cruise Control. Writing your test first encourages one to make the code so it can be tested in the first place. Often code that has not had the unit test written first needs to be re-factored before it can be tested which is in itself a risky activity. Writing your test first prevents you wasting your time building some sophisticated framework that does everything only to discover at a later moment in time that is problematic. For example the framework may have lots of bugs and the original requirements that inspired its creation may have since changed making the framework more of a hindrance than a help. Unit tests inspire you to get the minimum work done to pass the test. As the requirements become more particular so can the unit tests be modified to reflect the new requirements. Unit tests are consequently very much the corner stone of Agile Programming they create an agile approach to programming that is results based. Having 100% code coverage of the code by JUnit tests allows the code to be continuously re-factored or modified. What is Continuous Integration? Cruise Control notices that a developer has checked some code into the Subversion Code Repository. A Code repository is a database where programmers share code. Subversion is a popular Code Repository program. It was written by some of the Guys who wrote CVS, but is better. Cruise Control waits for example 5 minutes after the last bit of code was checked in and then triggers all the code to be checked out to a certain directory on the machine hosting Cruise Control. The time it waits after the last bit of code was checked in is a configurable attribute. After all the code is checked out Ant tasks are triggered to compile and package the code. Another Ant task triggers the JUnit tests to run. JUnit tests are written in Java to test small units of Java Code. The results of the build and JUnit tests can be published in HTML format. If the build process or unit testing fails, s are automatically sent to Developers. What benefits does using JUnit with Continuous Integration give us? By using JUnit in conjunction with ANT, Cruise Control and Subversion, one can be

7 reasonably sure that any modifications, deletions or re-factorings of the code base that have been done in error will cause the Ant build or JUnit tests to fail. Re-factoring means changing the code so that it becomes more reusable, maintainable, understandable and if necessary more efficient. Failures will be brought to everyone s attention. This means that the problems can be immediately solved. Without Continuous Integration problems may not be noticed before the code gets handled over to the formal testing team. By catching error early on one is in a better position to produce bug free code. Catching errors in real time without having to go through many formal testing cycles saves money. Continuous Integration reduces reliance on formal testing. This is good because formal testing is expensive. Formal testing involves taking snapshots of code, passing builds across to the testing team. These snapshots of code may become separate branches in the code repository (Subversion). Branching means is that the developers continue working and introducing new features on the main code base while the testers test the code on the other code branch. Bug reports are sent to the developers who will often fix the bug on both branches. After the fixes a new snapshot of the code is taken, a build produced and passed over to the testers to test whether the bugs have indeed been fixed. Shoving the code backwards and forwards between the formal testers and the developers is both a costly and time consuming process. Thus producing bug free code in the first place using Continuous Integration is both a time and cost saver. Without unit testing and Continuous Integration, re-factoring becomes risky and expensive. Developers are too timid to change existing code out of fear that it will create lots of new bugs which will only become evident when the code is passed over to the formal testing team. These same developers will consequently not change the code to make it more reusable, maintainable, understandable or efficient. The code base will gradually deterioate to the extent that at some point in time, upper management will take the radical decision to totally replace the system at a serious expense! However in cases where Continuous Integration is used, re-factoring becomes a low risk activity as any mistakes in the re-factoring are instantaneously brought to everyone s attention. Developers are consequently more likely too re-factor code.\

8 JUnit Documentation This section has examples of code that can be found in the /junit/01_example folder of the examples. If you would like to compile or run the code please download Examples. You can download JUnit from: Download the latest non beta version. At the time of writing this was:e.g. junit4.8.zip The following files in the zip file are pretty useful: /README.html This README points you to other resources /doc/faq/faq.htm This FAQ is pretty good This has good javadocs. First Junit Test This section introduces you to writing JUnit tests using annotations Start by looking at the class we wish to test. You can find the source in the following location: /08_junit/03_example/SVN_LOCAL/implementation/src/com/jjpeople/hellouniverse/HelloUnive rse.java Source Code: A01 /* A02 JDickerson A03 * Created on 15 Oct 2008 A04 */ A05 package com.jjpeople.hellouniverse; A06 A07 import java.text.dateformat; A08 import java.text.simpledateformat; A09 import java.util.date; A10 A11 import org.apache.log4j.basicconfigurator; A12 import org.apache.log4j.logger; A13 A14 /** A15 * Class implementing behaviour to say hello to the universe A16 * A17 JDickerson A18 * Created on 15 Oct 2008 A19 */ A20 public class HelloUniverse {

9 A21 A22 public static final String AGE_OF_UNIVERSE = A23 "3.7 +/- 0.2 Gyr where one Gyr is 10 ^ 24"; A24 A25 // Telling logger to log this class A26 public static final Logger logger = A27 Logger.getLogger( HelloUniverse.class ); A30 /** A31 * Constructor A32 */ A33 public HelloUniverse() { A34 A35 super(); A36 } A39 /** A40 * Method saying hello to the universe, the age of the universe and A41 * the current time A42 * A43 time current time A44 the message to say hello to the universe with A45 */ A46 public String sayhello( String time ) { A47 A48 String message = A49 "Hello Universe! Your age is " + AGE_OF_UNIVERSE A50 + " and the time is: " + time; A51 A52 return message; A53 } A56 /** A57 * Entry point to application A58 * A59 args arguments to pass to this application from the command line. A60 * There are no command line arguments for this application. A61 */ A62 public static void main(string[] args) { A63 A64 BasicConfigurator.configure(); A65 A66 HelloUniverse hellouniverse = new HelloUniverse(); A68 DateFormat timeformat = new SimpleDateFormat( "hh:mm:ss" );

10 A69 A70 String time = timeformat.format( new Date() ); A71 A72 String message = hellouniverse.sayhello( time ); A73 logger.info( message ); A74 } A75 } The methods we wish to test are sayhello(..) Now lets look at at the unit test. You can find the source in the following location: /08_junit/03_example/SVN_LOCAL/junit/src/com/jjpeople/hellouniverse/HelloUniverseTest.jav a Source Code: B002 JDickerson B003 * Created on 15 Oct 2008 B004 */ B005 package com.jjpeople.hellouniverse; B006 B007 // You can import static methods B008 import static org.junit.assert.assertequals; B010 import java.text.dateformat; B011 import java.text.simpledateformat; B012 import java.util.date; B014 import org.apache.log4j.basicconfigurator; B015 import org.apache.log4j.logger; B016 import org.junit.after; B017 import org.junit.afterclass; B018 import org.junit.before; B019 import org.junit.beforeclass; B020 import org.junit.test; B023 /** B024 * Test class testing functionality of B025 * com.jjpeople.hellouniverse.hellouniversetest B026 * B027 JDickerson B028 * Created on 15 Oct 2008 B029 */ B030 public class HelloUniverseTest { B031 B032 public static final Logger logger = B033 Logger.getLogger( HelloUniverseTest.class );

11 B034 B035 private static HelloUniverse hellouniverse; B036 B037 private Date date; B038 B040 public static void onetimesetup() { B041 B042 // one-time initialization code gets called before all tests B043 logger.debug( B044 "In method onetimesetup() which has ); B045 B046 hellouniverse = new HelloUniverse(); B047 } B051 public static void onetimeteardown() { B052 B053 // one-time initialization code gets called before all tests B054 logger.debug( B055 "In method onetimesetup() which has ); B056 B057 hellouniverse = new HelloUniverse(); B058 } B059 B060 B062 public void setup() { B063 B064 // Gets called before each test method that is annotated with B065 // the B066 B067 logger.debug( B068 "In method setup() which has ); B069 B070 date = new Date(); B071 } B072 B073 B075 public void teaddown() {

12 B076 B077 // Gets called after each test method that is annotated with B078 // the B079 B080 logger.debug( B081 "In method teaddown() which has ); B082 } B083 B084 B086 public void testsayhello() { B087 B088 // This method test the sayhello() method of HelloUniverse B089 B090 DateFormat timeformat = new SimpleDateFormat( "hh:mm:ss" ); B091 B092 String time = timeformat.format( date ); B093 B094 String expected = B095 "Hello Universe! Your age is " + HelloUniverse.AGE_OF_UNIVERSE + B096 " and the time is: " + time; B097 B098 logger.debug( "expected = \n[" + expected + "]" ); B099 B100 String actual = hellouniverse.sayhello( time ); B101 B102 logger.debug( "actual = \n[" + actual + "]" ); B103 B104 assertequals( expected, actual ); B105 } B108 // You make your JUnit 4 test classes accessible to a TestRunner designed B109 // to work with earlier versions of JUnit, declare a static method suite B110 // that returns a test. B111 // public static junit.framework.test suite() { B112 // B113 // return new JUnit4TestAdapter( HelloUniverseTest.class ); B114 // } B115 B116 B117 /**

13 B118 * Entry point to this Test B119 * B120 args arguments to be passed to this application. This application B121 * expects no arguments B122 */ B123 public static void main( String args[] ) { B124 B125 BasicConfigurator.configure(); B126 B127 //This runs the classes without running the asserts: B128 // org.junit.runner.junitcore.runclasses( HelloUniverseTest.class ); B129 B130 // This runs the tests B131 org.junit.runner.junitcore.main( HelloUniverseTest.class.getName() ); B132 } B133 } Lets start by looking at the main() method of the test class. A runner is used to run the test: B123 public static void main( String args[] ) { B124 B125 BasicConfigurator.configure(); B126 B127 //This runs the classes without running the asserts: B128 // org.junit.runner.junitcore.runclasses( HelloUniverseTest.class ); B129 B130 // This runs the tests B131 org.junit.runner.junitcore.main( HelloUniverseTest.class.getName() ); B132 } The main() method of the test runner, JUnitCore loads up the class and inspects it for annotations. Annotations are those names on the top of methods that start with sign. For example: B039 B050

14 annotation appears above the test methods. Before executing each and every test method the runner will invoke the method that is annotated The idea is that you add code to method to set up the environment for that test. After executing a given test method the runner will invoke the method that is annotated The idea is that you add code to method that tidies up the environment after the test. Methods annotated Class are invoked only once and just before invoking any of methods. These methods are used to set up the environment for all of the tests. Methods annotated Class are invoked only once and just after invoking all methods. These methods are used to tidy up the environment for all the tests. Explanation annotation is telling the runner that the method is a test method: B086 public void testsayhello() { B087 B088 // This method test the sayhello() method of HelloUniverse B089 B090 DateFormat timeformat = new SimpleDateFormat( "hh:mm:ss" ); B091 B092 String time = timeformat.format( date ); B093 B094 String expected = B095 "Hello Universe! Your age is " + HelloUniverse.AGE_OF_UNIVERSE + B096 " and the time is: " + time; B097 B098 logger.debug( "expected = \n[" + expected + "]" ); B099 B100 String actual = hellouniverse.sayhello( time ); B101 B102 logger.debug( "actual = \n[" + actual + "]" ); B103 B104 assertequals( expected, actual ); B105 }

15 This test method is invoked by the runner after it has invoked: (a) The method annotated (b) The method annotated The key line in this test method is the assertequals(..) line: B104 assertequals( expected, actual ); The assertequals method is a static test method that was imported on line B008: B008 import static org.junit.assert.assertequals; The assertequals method compares expected results against actual results If the expected results are different from actual respects the test fails. In the case of this example, however expected is equal to actual so the test passes and the following output is written to the console: C01 JUnit version 4.5 C02 0 [main] DEBUG com.jjpeople.hellouniverse.hellouniversetest _ - In method onetimesetup() which has an C03 C03.16 [main] DEBUG com.jjpeople.hellouniverse.hellouniversetest _ - In method setup() which has C04 31 [main] DEBUG com.jjpeople.hellouniverse.hellouniversetest _ - expected = C05 [Hello Universe! Your age is 3.7 +/- 0.2 Gyr where one Gyr is _ 10 ^ 24 and the time is: 03:28:27] C06 31 [main] DEBUG com.jjpeople.hellouniverse.hellouniversetest _ - actual = C07 [Hello Universe! Your age is 3.7 +/- 0.2 Gyr where one Gyr is _ 10 ^ 24 and the time is: 03:28:27] C08 62 [main] DEBUG com.jjpeople.hellouniverse.hellouniversetest - _ In method teaddown() which has C10 62 [main] DEBUG com.jjpeople.hellouniverse.hellouniversetest - _ In method onetimesetup() which has a C11 C12 Time: C13 C14 OK (1 test) Note that there are many different assert methods depending on the type of objects you are comparing the expected results against the actual results with. To see the javadocs for these assert methods: You can download JUnit from:

16 e.g. junit4.8.zip Unzip it and take a look at: /javadoc/index.html Take a look at the following class: org.junit.assert for the different assert methods available. The methods which are not deprecated include: static void assertarrayequals(byte[] expecteds, byte[] actuals) Asserts that two byte arrays are equal. static void assertarrayequals(char[] expecteds, char[] actuals) Asserts that two char arrays are equal. static void assertarrayequals(int[] expecteds, int[] actuals) Asserts that two int arrays are equal. static void assertarrayequals(long[] expecteds, long[] actuals) Asserts that two long arrays are equal. static void assertarrayequals( java.lang.object[] expecteds, java.lang.object[] actuals) Asserts that two object arrays are equal. static void assertarrayequals(short[] expecteds, short[] actuals) Asserts that two short arrays are equal. static void assertarrayequals( java.lang.string message, byte[] expecteds, byte[] actuals) Asserts that two byte arrays are equal. static void assertarrayequals( java.lang.string message, char[] expecteds, char[] actuals) Asserts that two char arrays are equal. static void assertarrayequals( java.lang.string message, int[] expecteds, int[] actuals) Asserts that two int arrays are equal. static void assertarrayequals( java.lang.string message, long[] expecteds, long[] actuals) Asserts that two long arrays are equal.

17 static void assertarrayequals( java.lang.string message, java.lang.object[] expecteds, java.lang.object[] actuals) Asserts that two object arrays are equal. static void assertarrayequals( java.lang.string message, short[] expecteds, short[] actuals) Asserts that two short arrays are equal. static void assertequals(double expected, double actual, double delta) Asserts that two doubles or floats are equal to within a positive delta. static void assertequals(long expected, long actual) Asserts that two longs are equal. static void assertequals(java.lang.object expected, java.lang.object actual) Asserts that two objects are equal. static void assertequals( java.lang.string message, double expected, double actual, double delta) Asserts that two doubles or floats are equal to within a positive delta. static void assertequals( java.lang.string message, long expected, long actual) Asserts that two longs are equal. static void assertequals( java.lang.string message, java.lang.object expected, java.lang.object actual) Asserts that two objects are equal. static void assertfalse(boolean condition) Asserts that a condition is false. static void assertfalse(java.lang.string message, boolean condition) Conclusion It is better to write your unit tests before you even write the code. This is called Test Driven Development. An Agile Developer may develop his code as follows:

18 Create a Unit Test, including the assert methods. The code makes references to interfaces it is testing that do not even exist yet so the code does not compile Implement the interfaces of the code we are testing and if necessary some of the classes. If it is necessary to implement the classes so that the code compiles then do so but do not at this stage implement the bodies of the methods. If a method returns something just temporarily return null. Try and compile the Unit Test. It should now compile but will not pass the test. Now start implementing the classes that implement the interfaces. Use a "Top to Bottom" approach. What this means is that we start at the top (i.e. the methods we are testing in the unit test) and then decide as we go along what other public, friendly, protected or private methods we require. As you develop these other methods, you may put your current development for the test in question on hold and develop the unit test for one of these nearer the "bottom" methods. Once the unit test of one of these "Nearer the Bottom" methods passes then resume development of the original test method you commenced development with. Using this Agile "Top to Bottom" approach to development of code provides discipline to the coding experience. This approach encourages creating code when is only strictly necessary. It tends to speed up development and produce bug free and streamlined code. Try this "top to bottom" approach using unit testing and you will be surprised at how you will be able to implement complex code quickly. You will find that adopting a "top to bottom" approach will make you ask the right questions to yourself. You will be forced to ask the correct questions and subsequently answer them correctly by the "Top to bottom" unit test methodology itself. Introduction to ANT Ant is an open source build tool written in Java which uses XML to configure builds related tasks useful for Agile Programming. Among other tasks, it can be used for compiling, packaging, testing and deploying applications. There are lots of core tasks bundled with Ant and also lots of other third party tasks. If you cannot find a task to do the job you can always create an Ant task yourself. Ant and Agile Programming Methodology Agile Programming Methodology is about bringing the business, development and testing closer together. Continuous Integration provides real time testing of the code base and brings testing and development closer together. By using Ant in conjunction with Cruise Control and Subversion, one can be reasonably sure that any modifications, deletions or re-factorings of the code base that have been done in

JUnit Framework. Terminology: assertions, annotations, fixtures. Dr. Siobhán Drohan Mairead Meagher. Produced by:

JUnit Framework. Terminology: assertions, annotations, fixtures. Dr. Siobhán Drohan Mairead Meagher. Produced by: JUnit Framework Terminology: assertions, annotations, fixtures Produced by: Dr. Siobhán Drohan Mairead Meagher Department of Computing and Mathematics http://www.wit.ie/ Topic List General Terminology

More information

EECS 4313 Software Engineering Testing

EECS 4313 Software Engineering Testing EECS 4313 Software Engineering Testing Topic 03: Test automation / JUnit - Building automatically repeatable test suites Zhen Ming (Jack) Jiang Acknowledgement Some slides are from Prof. Alex Orso Relevant

More information

Test automation / JUnit. Building automatically repeatable test suites

Test automation / JUnit. Building automatically repeatable test suites Test automation / JUnit Building automatically repeatable test suites Test automation n Test automation is software that automates any aspect of testing n Generating test inputs and expected results n

More information

Test automation Test automation / JUnit

Test automation Test automation / JUnit Test automation Test automation / JUnit Building automatically repeatable test suites Test automation is software that automates any aspect of testing Generating test inputs and expected results Running

More information

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit

ICOM 4015 Advanced Programming Laboratory. Chapter 1 Introduction to Eclipse, Java and JUnit ICOM 4015 Advanced Programming Laboratory Chapter 1 Introduction to Eclipse, Java and JUnit University of Puerto Rico Electrical and Computer Engineering Department by Juan E. Surís 1 Introduction This

More information

Procedural Java. Procedures and Static Class Methods. Functions. COMP 210: Object-Oriented Programming Lecture Notes 2.

Procedural Java. Procedures and Static Class Methods. Functions. COMP 210: Object-Oriented Programming Lecture Notes 2. COMP 210: Object-Oriented Programming Lecture Notes 2 Procedural Java Logan Mayfield In these notes we look at designing, implementing, and testing basic procedures in Java. We will rarely, perhaps never,

More information

CS211 Computers and Programming Matthew Harris and Alexa Sharp July 9, Boggle

CS211 Computers and Programming Matthew Harris and Alexa Sharp July 9, Boggle Boggle If you are not familiar with the game Boggle, the game is played with 16 dice that have letters on all faces. The dice are randomly deposited into a four-by-four grid so that the players see the

More information

Testing Stragegies. Black Box Testing. Test case

Testing Stragegies. Black Box Testing. Test case References: Teach Yourself Object-Oriented Programming in 21 Days by A.Sintes, 1 Testing Stragegies Test case a set of inputs and expected outputs looks at specific piece of functionality to determine

More information

CS18000: Programming I

CS18000: Programming I CS18000: Programming I Testing Basics 19 April 2010 Prof. Chris Clifton Testing Programs Your programs are getting large and more complex How do you make sure they work? 1. Reason about the program Think

More information

All code must follow best practices. Part (but not all) of this is adhering to the following guidelines:

All code must follow best practices. Part (but not all) of this is adhering to the following guidelines: Java Coding Guidelines Version 1.3.2 All code must follow best practices. Part (but not all) of this is adhering to the following guidelines: Development For code development, I recommend the following

More information

Object Oriented Software Design - I

Object Oriented Software Design - I Object Oriented Software Design - I Unit Testing Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa November 28, 2011 G. Lipari (Scuola Superiore Sant Anna) Unit Testing November

More information

Introduc)on to tes)ng with JUnit. Workshop 3

Introduc)on to tes)ng with JUnit. Workshop 3 Introduc)on to tes)ng with JUnit Workshop 3 We have to deal with errors Early errors are usually syntax errors. The compiler will spot these. Later errors are usually logic errors. The compiler cannot

More information

Tutorial 3: Unit tests and JUnit

Tutorial 3: Unit tests and JUnit Tutorial 3: Unit tests and JUnit Runtime logic errors, such as contract violations, are among the more frequent in a poorly debugged program. Logic error should be fixed. However, to fix an error we need

More information

Tools for Unit Test - JUnit

Tools for Unit Test - JUnit Tools for Unit Test - JUnit Conrad Hughes School of Informatics Slides thanks to Stuart Anderson 15 January 2010 Software Testing: Lecture 2 1 JUnit JUnit is a framework for writing tests Written by Erich

More information

Test-Driven Development JUnit

Test-Driven Development JUnit Test-Driven Development JUnit Click to edit Master EECS text 2311 styles - Software Development Project Second level Third level Fourth level Fifth level Wednesday, January 18, 2017 1 Simulator submission

More information

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 to you at

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 to you at JUnit 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 to you at the moment), or You can build a test suite (a thorough

More information

public static boolean isoutside(int min, int max, int value)

public static boolean isoutside(int min, int max, int value) See the 2 APIs attached at the end of this worksheet. 1. Methods: Javadoc Complete the Javadoc comments for the following two methods from the API: (a) / @param @param @param @return @pre. / public static

More information

Testing. Topics. Types of Testing. Types of Testing

Testing. Topics. Types of Testing. Types of Testing Topics 1) What are common types of testing? a) Testing like a user: through the UI. b) Testing like a dev: through the code. 2) What makes a good bug report? 3) How can we write code to test code (via

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

Java Intro 3. Java Intro 3. Class Libraries and the Java API. Outline

Java Intro 3. Java Intro 3. Class Libraries and the Java API. Outline Java Intro 3 9/7/2007 1 Java Intro 3 Outline Java API Packages Access Rules, Class Visibility Strings as Objects Wrapper classes Static Attributes & Methods Hello World details 9/7/2007 2 Class Libraries

More information

Tools for Unit Test JUnit

Tools for Unit Test JUnit Tools for Unit Test JUnit Stuart Anderson JUnit is a framework for writing tests JUnit 1 Written by Erich Gamma (Design Patterns) and Kent Beck (extreme Programming) JUnit uses Java s reflection capabilities

More information

CSE 326: Data Structures. Section notes, 4/9/2009

CSE 326: Data Structures. Section notes, 4/9/2009 CSE 326: Data Structures Java Generi ics & JUnit 4 Section notes, 4/9/2009 slides originally by Hal Perkins Type-Safe Containers Idea a class or interface can have a type parameter: public class Bag

More information

Binghamton University. CS-140 Fall Unit Testing

Binghamton University. CS-140 Fall Unit Testing Unit Testing 1 Test Early, Test Often 2 Informal Unit Testing public static void main(string[] args) { Rectangle rect = new Rectangle ( new Point(20,30), 20,40 ); System.out.println("Created " + rect);

More information

Testing on Steriods EECS /30

Testing on Steriods EECS /30 1/30 Testing on Steriods EECS 4315 www.eecs.yorku.ca/course/4315/ How to test code? 2/30 input code output Provide the input. Run the code. Compare the output with the expected output. White box testing

More information

Binghamton University. CS-140 Fall Unit Testing

Binghamton University. CS-140 Fall Unit Testing Unit Testing 1 Test Early, Test Often 2 Informal Unit Testing package lab05; import java.lang.illegalargumentexception; public class ProfTest { public static void main(string[] args) { System.out.println("Professor

More information

Video 2.1. Arvind Bhusnurmath. Property of Penn Engineering, Arvind Bhusnurmath. SD1x-2 1

Video 2.1. Arvind Bhusnurmath. Property of Penn Engineering, Arvind Bhusnurmath. SD1x-2 1 Video 2.1 Arvind Bhusnurmath SD1x-2 1 Topics Why is testing important? Different types of testing Unit testing SD1x-2 2 Software testing Integral part of development. If you ship a software with bugs,

More information

Basic Keywords Practice Session

Basic Keywords Practice Session Basic Keywords Practice Session Introduction In this article from my free Java 8 course, we will apply what we learned in my Java 8 Course Introduction to our first real Java program. If you haven t yet,

More information

Topics covered. Introduction to JUnit JUnit: Hands-on session Introduction to Mockito Mockito: Hands-on session. JUnit & Mockito 2

Topics covered. Introduction to JUnit JUnit: Hands-on session Introduction to Mockito Mockito: Hands-on session. JUnit & Mockito 2 JUnit & Mockito 1 Topics covered Introduction to JUnit JUnit: Hands-on session Introduction to Mockito Mockito: Hands-on session JUnit & Mockito 2 Introduction to JUnit JUnit & Mockito 3 What is JUnit?

More information

C++ for Java Programmers

C++ for Java Programmers Basics all Finished! Everything we have covered so far: Lecture 5 Operators Variables Arrays Null Terminated Strings Structs Functions 1 2 45 mins of pure fun Introduction Today: Pointers Pointers Even

More information

Test-Driven Development JUnit

Test-Driven Development JUnit Test-Driven Development JUnit Click to edit Master EECS text 2311 styles - Software Development Project Second level Third level Fourth level Fifth level Wednesday, January 24, 2018 1 Unit Testing Testing

More information

F1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept

F1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept F1 A Java program Ch 1 in PPIJ Introduction to the course The computer and its workings The algorithm concept The structure of a Java program Classes and methods Variables Program statements Comments Naming

More information

Thinking Functionally

Thinking Functionally Thinking Functionally Dan S. Wallach and Mack Joyner, Rice University Copyright 2016 Dan S. Wallach, All Rights Reserved Reminder: Fill out our web form! Fill this out ASAP if you haven t already. http://goo.gl/forms/arykwbc0zy

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists

ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists ASSIGNMENT 5 Data Structures, Files, Exceptions, and To-Do Lists COMP-202B, Winter 2009, All Sections Due: Tuesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise

More information

Analysis of the Test Driven Development by Example

Analysis of the Test Driven Development by Example Computer Science and Applications 1 (2013) 5-13 Aleksandar Bulajic and Radoslav Stojic The Faculty of Information Technology, Metropolitan University, Belgrade, 11000, Serbia Received: June 18, 2013 /

More information

Step 2. Creating and running a project(core)

Step 2. Creating and running a project(core) Getting started with the HelloWorld application based on the e-government Framework Summary This guide provides a HelloWorld tutorial to quickly work through features of the egovframe. It assumes the target

More information

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Course Overview This course teaches programmers the skills necessary to create Java programming system applications and satisfies the

More information

Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore

Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore Lecture 04 Software Test Automation: JUnit as an example

More information

White box testing. White-box testing. Types of WBT 24/03/15. Advanced Programming

White box testing. White-box testing. Types of WBT 24/03/15. Advanced Programming White box testing Advanced Programming 24/03/15 Barbara Russo 1 White-box testing White-box testing is a verification technique software engineers can use to examine if their code works as expected 24/03/15

More information

Introduction to JUnit. Data Structures and Algorithms for Language Processing

Introduction to JUnit. Data Structures and Algorithms for Language Processing Data Structures and Algorithms for Language Processing What is JUnit JUnit is a small, but powerful Java framework to create and execute automatic unit tests Unit testing is the test of a part of a program

More information

16-Dec-10. Consider the following method:

16-Dec-10. Consider the following method: Boaz Kantor Introduction to Computer Science IDC Herzliya Exception is a class. Java comes with many, we can write our own. The Exception objects, along with some Java-specific structures, allow us to

More information

Software Development Tools. COMP220/COMP285 Sebastian Coope Eclipse and JUnit: Creating and running a JUnit test case

Software Development Tools. COMP220/COMP285 Sebastian Coope Eclipse and JUnit: Creating and running a JUnit test case Software Development Tools COMP220/COMP285 Sebastian Coope Eclipse and JUnit: Creating and running a JUnit test case These slides are mainly based on Java Development with Eclipse D.Gallardo et al., Manning

More information

Test automation / JUnit. Building automatically repeatable test suites

Test automation / JUnit. Building automatically repeatable test suites Test automation / JUnit Building automatically repeatable test suites JUnit in Eclipse For this course, we will use JUnit in Eclipse It is automatically a part of Eclipse One documentation site (all one

More information

11 Using JUnit with jgrasp

11 Using JUnit with jgrasp 11 Using JUnit with jgrasp jgrasp includes an easy to use plug-in for the JUnit testing framework. JUnit provides automated support for unit testing of Java source code, and its utility has made it a de

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

Tuesday, November 15. Testing

Tuesday, November 15. Testing Tuesday, November 15 1 Testing Testing Waterfall model show testing as an activity or box In practice, testing is performed constantly There has never been a project where there was too much testing. Products

More information

What is Testing? Table of Contents

What is Testing? Table of Contents Testing Table of Contents Testing - From Hating to... Fishing What is Testing? Validation. Verification. Testing The Testing Process Testing vs. Debugging Testing Techniques Black-box Testing Glass-box

More information

Chapter 11 Paper Practice

Chapter 11 Paper Practice Chapter 11 Paper Practice Scrambled Code For each method, rearrange the lines of code in order to build the functionality required by the specification and tests. To accomplish this, you are given three

More information

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch

Binghamton University. CS-140 Fall Problem Solving. Creating a class from scratch Problem Solving Creating a class from scratch 1 Recipe for Writing a Class 1. Write the class boilerplate stuff 2. Declare Fields 3. Write Creator(s) 4. Write accessor methods 5. Write mutator methods

More information

CSCE 747 Unit Testing Laboratory Name(s):

CSCE 747 Unit Testing Laboratory Name(s): CSCE 747 Unit Testing Laboratory Name(s): You have been hired to test our new calendar app! Congrats!(?) This program allows users to book meetings, adding those meetings to calendars maintained for rooms

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 11 January 2018 SP1-Lab1-2017-18.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon

More information

Exceptions and Libraries

Exceptions and Libraries Exceptions and Libraries RS 9.3, 6.4 Some slides created by Marty Stepp http://www.cs.washington.edu/143/ Edited by Sarah Heckman 1 Exceptions exception: An object representing an error or unusual condition.

More information

Testing. Technion Institute of Technology Author: Assaf Israel. Author: Assaf Israel - Technion

Testing. Technion Institute of Technology Author: Assaf Israel. Author: Assaf Israel - Technion Testing Technion Institute of Technology 236700 1 Author: Assaf Israel Why test? Programming is incremental by nature We want to verify we haven t broken anything Tests not only examine the code s functionality

More information

JAVA GUI PROGRAMMING REVISION TOUR III

JAVA GUI PROGRAMMING REVISION TOUR III 1. In java, methods reside in. (a) Function (b) Library (c) Classes (d) Object JAVA GUI PROGRAMMING REVISION TOUR III 2. The number and type of arguments of a method are known as. (a) Parameter list (b)

More information

Program development plan

Program development plan Appendix A Program development plan If you are spending a lot of time debugging, it is probably because you do not have an effective program development plan. A typical, bad program development plan goes

More information

Test-Driven Development (a.k.a. Design to Test) CSE260, Computer Science B: Honors Stony Brook University

Test-Driven Development (a.k.a. Design to Test) CSE260, Computer Science B: Honors Stony Brook University Test-Driven Development (a.k.a. Design to Test) CSE260, Computer Science B: Honors Stony Brook University http://www.cs.stonybrook.edu/~cse260 Person-hours Labor is sometimes measured in person-hours,

More information

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment

More information

ASSIGNMENT 5 Objects, Files, and a Music Player

ASSIGNMENT 5 Objects, Files, and a Music Player ASSIGNMENT 5 Objects, Files, and a Music Player COMP-202A, Fall 2009, All Sections Due: Thursday, December 3, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified, you

More information

Chapter 9. Software Testing

Chapter 9. Software Testing Chapter 9. Software Testing Table of Contents Objectives... 1 Introduction to software testing... 1 The testers... 2 The developers... 2 An independent testing team... 2 The customer... 2 Principles of

More information

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance Contents Topic 04 - Inheritance I. Classes, Superclasses, and Subclasses - Inheritance Hierarchies Controlling Access to Members (public, no modifier, private, protected) Calling constructors of superclass

More information

CS 170 Java Programming 1. Week 13: Classes, Testing, Debugging

CS 170 Java Programming 1. Week 13: Classes, Testing, Debugging CS 170 Java Programming 1 Week 13: Classes, Testing, Debugging What s the Plan? Short lecture for makeup exams Topic 1: A Little Review How to create your own user-defined classes Defining instance variables,

More information

CMPSCI 187 / Spring 2015 Implementing Sets Using Linked Lists

CMPSCI 187 / Spring 2015 Implementing Sets Using Linked Lists CMPSCI 187 / Spring 2015 Implementing Sets Using Linked Lists Due on Tuesday February 24, 2015, 8:30 a.m. Marc Liberatore and John Ridgway Morrill I N375 Section 01 @ 10:00 Section 02 @ 08:30 1 CMPSCI

More information

Testing. My favourite testing quote: Program testing can be used to show the presence of bugs, but never to show their absence!

Testing. My favourite testing quote: Program testing can be used to show the presence of bugs, but never to show their absence! Testing Some resources The most time-consuming of a development project. See for example https://www.itu.dk/people/sestoft/ papers/softwaretesting.pdf - Peter Sestoft testing notes Testing My favourite

More information

Software Design Models, Tools & Processes. Lecture 6: Transition Phase Cecilia Mascolo

Software Design Models, Tools & Processes. Lecture 6: Transition Phase Cecilia Mascolo Software Design Models, Tools & Processes Lecture 6: Transition Phase Cecilia Mascolo UML Component diagram Component documentation Your own classes should be documented the same way library classes are.

More information

Agenda. JUnit JaCoCo Project. CSE 4321, Jeff Lei, UTA

Agenda. JUnit JaCoCo Project. CSE 4321, Jeff Lei, UTA Agenda JUnit JaCoCo Project 1 JUnit Introduction A JUnit Example Major APIs Practical Tips 2 Unit Testing Test individual units of source code in isolation Procedures, functions, methods, and classes Engineers

More information

Java Programming. Atul Prakash

Java Programming. Atul Prakash Java Programming Atul Prakash Java Language Fundamentals The language syntax is similar to C/ C++ If you know C/C++, you will have no trouble understanding Java s syntax If you don't, it will be easier

More information

UNIT TESTING. Krysta Yousoufian CSE 331 Section April 19, With material from Marty Stepp, David Notkin, and The Pragmatic Programmer

UNIT TESTING. Krysta Yousoufian CSE 331 Section April 19, With material from Marty Stepp, David Notkin, and The Pragmatic Programmer UNIT TESTING Krysta Yousoufian CSE 331 Section April 19, 2012 With material from Marty Stepp, David Notkin, and The Pragmatic Programmer JUnit Semantics How to write a technically correct JUnit test A

More information

Express Yourself. Writing Your Own Classes

Express Yourself. Writing Your Own Classes Java Programming 1 Lecture 5 Defining Classes Creating your Own Classes Express Yourself Use OpenOffice Writer to create a new document Save the file as LastFirst_ic05 Replace LastFirst with your actual

More information

CSE 142 Su 04 Computer Programming 1 - Java. Objects

CSE 142 Su 04 Computer Programming 1 - Java. Objects Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request

More information

CHAPTER 7 OBJECTS AND CLASSES

CHAPTER 7 OBJECTS AND CLASSES CHAPTER 7 OBJECTS AND CLASSES OBJECTIVES After completing Objects and Classes, you will be able to: Explain the use of classes in Java for representing structured data. Distinguish between objects and

More information

Advanced Object Oriented Programming EECS2030Z

Advanced Object Oriented Programming EECS2030Z Advanced Object Oriented Programming EECS2030Z 1 Who Am I? Dr. Burton Ma office Lassonde 2046 hours : to be updated on the syllabus page email burton@cse.yorku.ca 2 Course Format everything you need to

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 17 January 2019 SP1-Lab1-2018-19.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon

More information

CS 251 Intermediate Programming Methods and Classes

CS 251 Intermediate Programming Methods and Classes CS 251 Intermediate Programming Methods and Classes Brooke Chenoweth University of New Mexico Fall 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

CS 251 Intermediate Programming Methods and More

CS 251 Intermediate Programming Methods and More CS 251 Intermediate Programming Methods and More Brooke Chenoweth University of New Mexico Spring 2018 Methods An operation that can be performed on an object Has return type and parameters Method with

More information

Laboratory 1: Eclipse and Karel the Robot

Laboratory 1: Eclipse and Karel the Robot Math 121: Introduction to Computing Handout #2 Laboratory 1: Eclipse and Karel the Robot Your first laboratory task is to use the Eclipse IDE framework ( integrated development environment, and the d also

More information

Annotations in Java (JUnit)

Annotations in Java (JUnit) Annotations in Java (JUnit) Produced by: Eamonn de Leastar (edeleastar@wit.ie) Dr. Siobhán Drohan (sdrohan@wit.ie) Department of Computing and Mathematics http://www.wit.ie/ What are Annotations? They

More information

Java Classes - Using your classes. How the classes you write are being used

Java Classes - Using your classes. How the classes you write are being used Java Classes - Using your classes How the classes you write are being used What s the use of classes? So, you have been writing a few classes by now... What for? The programs you will write will use objects

More information

CS201 - Assignment 3, Part 1 Due: Friday February 28, at the beginning of class

CS201 - Assignment 3, Part 1 Due: Friday February 28, at the beginning of class CS201 - Assignment 3, Part 1 Due: Friday February 28, at the beginning of class One of the keys to writing good code is testing your code. This assignment is going to introduce you and get you setup to

More information

Getting It Right COMS W4115. Prof. Stephen A. Edwards Spring 2007 Columbia University Department of Computer Science

Getting It Right COMS W4115. Prof. Stephen A. Edwards Spring 2007 Columbia University Department of Computer Science Getting It Right COMS W4115 Prof. Stephen A. Edwards Spring 2007 Columbia University Department of Computer Science Getting It Right Your compiler is a large software system developed by four people. How

More information

CHAPTER 7 OBJECTS AND CLASSES

CHAPTER 7 OBJECTS AND CLASSES CHAPTER 7 OBJECTS AND CLASSES OBJECTIVES After completing Objects and Classes, you will be able to: Explain the use of classes in Java for representing structured data. Distinguish between objects and

More information

Table of Contents. Tutorial API Deployment Prerequisites... 1

Table of Contents. Tutorial API Deployment Prerequisites... 1 Copyright Notice All information contained in this document is the property of ETL Solutions Limited. The information contained in this document is subject to change without notice and does not constitute

More information

B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA

B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE

More information

Simple Component Writer's Guide

Simple Component Writer's Guide Simple Component Writer's Guide Note that most of the following also applies to writing ordinary libraries for Simple. The preferred language to write Simple components is Java, although it should be possible

More information

ASSIGNMENT 5 Objects, Files, and More Garage Management

ASSIGNMENT 5 Objects, Files, and More Garage Management ASSIGNMENT 5 Objects, Files, and More Garage Management COMP-202B, Winter 2010, All Sections Due: Wednesday, April 14, 2009 (23:55) You MUST do this assignment individually and, unless otherwise specified,

More information

1 Shyam sir JAVA Notes

1 Shyam sir JAVA Notes 1 Shyam sir JAVA Notes 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

More information

Array. Prepared By - Rifat Shahriyar

Array. Prepared By - Rifat Shahriyar Java More Details Array 2 Arrays A group of variables containing values that all have the same type Arrays are fixed length entities In Java, arrays are objects, so they are considered reference types

More information

13 th Windsor Regional Secondary School Computer Programming Competition

13 th Windsor Regional Secondary School Computer Programming Competition SCHOOL OF COMPUTER SCIENCE 13 th Windsor Regional Secondary School Computer Programming Competition Hosted by The School of Computer Science, University of Windsor WORKSHOP I [ Overview of the Java/Eclipse

More information

COMP 110/L Lecture 6. Kyle Dewey

COMP 110/L Lecture 6. Kyle Dewey COMP 110/L Lecture 6 Kyle Dewey Outline Methods Variable scope Call-by-value Testing with JUnit Variable Scope Question Does this compile? public class Test { public static void main(string[] args) { int

More information

COE318 Lecture Notes Week 9 (Oct 31, 2011)

COE318 Lecture Notes Week 9 (Oct 31, 2011) COE318 Software Systems Lecture Notes: Week 9 1 of 12 COE318 Lecture Notes Week 9 (Oct 31, 2011) Topics Casting reference variables equals() and hashcode() overloading Collections and ArrayList utilities

More information

White-box testing. Software Reliability and Testing - Barbara Russo SERG - Laboratory of Empirical Software Engineering.

White-box testing. Software Reliability and Testing - Barbara Russo SERG - Laboratory of Empirical Software Engineering. White-box testing Software Reliability and Testing - Barbara Russo SERG - Laboratory of Empirical Software Engineering Barbara Russo 1 White-box testing White-box testing is a verification technique that

More information

Assertions, pre/postconditions

Assertions, pre/postconditions Programming as a contract Assertions, pre/postconditions Assertions: Section 4.2 in Savitch (p. 239) Specifying what each method does q Specify it in a comment before method's header Precondition q What

More information

TDDC88 Lab 4 Software Configuration Management

TDDC88 Lab 4 Software Configuration Management TDDC88 Lab 4 Software Configuration Management Introduction "Version control is to programmers what the safety net is to a trapeze artist. Knowing the net is there to catch them if they fall, aerialists

More information

104. Intermediate Java Programming

104. Intermediate Java Programming 104. Intermediate Java Programming Version 6.0 This course teaches programming in the Java language -- i.e. the Java Standard Edition platform. It is intended for students with previous Java experience

More information

Introduction: Manual Testing :

Introduction: Manual Testing : : What is Automation Testing? Use of Automation. Where do we use. Tools that Do Automation. Web Applications vs Standalone Applications. What is selenium? How selenium works. Manual Testing : HTML: Detailed

More information

COE318 Lecture Notes Week 8 (Oct 24, 2011)

COE318 Lecture Notes Week 8 (Oct 24, 2011) COE318 Software Systems Lecture Notes: Week 8 1 of 17 COE318 Lecture Notes Week 8 (Oct 24, 2011) Topics == vs..equals(...): A first look Casting Inheritance, interfaces, etc Introduction to Juni (unit

More information

12/22/11. Java How to Program, 9/e. public must be stored in a file that has the same name as the class and ends with the.java file-name extension.

12/22/11. Java How to Program, 9/e. public must be stored in a file that has the same name as the class and ends with the.java file-name extension. Java How to Program, 9/e Education, Inc. All Rights Reserved. } Covered in this chapter Classes Objects Methods Parameters double primitive type } Create a new class (GradeBook) } Use it to create an object.

More information

Section 4: Graphs and Testing. Slides by Erin Peach and Nick Carney

Section 4: Graphs and Testing. Slides by Erin Peach and Nick Carney Section 4: Graphs and Testing Slides by Erin Peach and Nick Carney with material from Vinod Rathnam, Alex Mariakakis, Krysta Yousoufian, Mike Ernst, Kellen Donohue AGENDA Graphs JUnit Testing Test Script

More information

Programmieren II. Unit Testing & Test-Driven Development. Alexander Fraser.

Programmieren II. Unit Testing & Test-Driven Development. Alexander Fraser. Programmieren II Unit Testing & Test-Driven Development Alexander Fraser fraser@cl.uni-heidelberg.de (Based on material from Lars Vogel and T. Bögel) July 2, 2014 1 / 62 Outline 1 Recap 2 Testing - Introduction

More information

BM214E Object Oriented Programming Lecture 8

BM214E Object Oriented Programming Lecture 8 BM214E Object Oriented Programming Lecture 8 Instance vs. Class Declarations Instance vs. Class Declarations Don t be fooled. Just because a variable might be declared as a field within a class that does

More information

CSE 70 Final Exam Fall 2009

CSE 70 Final Exam Fall 2009 Signature cs70f Name Student ID CSE 70 Final Exam Fall 2009 Page 1 (10 points) Page 2 (16 points) Page 3 (22 points) Page 4 (13 points) Page 5 (15 points) Page 6 (20 points) Page 7 (9 points) Page 8 (15

More information