Programming Tools Eclipse JUnit Testing make and ant.

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

T ESTING WITH J UNIT IN E CLIPSE Farzana Rahman. I NTRODUCTION The class that you will want to test is created first so that Eclipse will be able to find.
Georgia Institute of Technology DrJava Appendix A Barb Ericson Georgia Institute of Technology May 2006.
Fall 2007CS 2251 Programming Tools Eclipse JUnit Testing make and ant.
Java Integrated Development Environments: ECLIPSE Part1 Installation.
1 Ant – Another Neat Tool Representation and Management of Data on the Internet.
Integrated Development Environments. Today We Will: Go over more advanced functionality of Eclipse. Break up into teams to work on presentation and final.
Fall 2007CS 2251 Programming Tools Eclipse JUnit Testing make and ant.
20-Jun-15 Eclipse. Most slides from: 2 About IDEs An IDE is an Integrated Development Environment.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of The Java Development Tools project.
CS 225 Section 1 Spring Topics Software design Correctness and Efficiency Inheritance Data structures –Lists, Stacks, Queues –Trees –Sets, Maps.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
1 CSC/ECE 517 Fall 2010 Lec. 2 Overview of Eclipse Lectures 1.Overview 2.Installing and Running 3.Building and Running Java Classes 4.Debugging 5.Testing.
Eclipse IDE. 2 IDE Overview An IDE is an Interactive Development Environment Different IDEs meet different needs BlueJ and DrJava are designed as teaching.
03 Using Eclipse. 2 IDE Overview An IDE is an Interactive Development Environment Different IDEs meet different needs BlueJ and DrJava are designed as.
Using Ant to build J2EE Applications Kumar
CSE 403 Lecture 11 Static Code Analysis Reading: IEEE Xplore, "Using Static Analysis to Find Bugs" slides created by Marty Stepp
Gdb is the GNU debugger on our CS machines. gdb is most effective when it is debugging a program that has debugging symbols linked in to it. With gcc and.
INF 111 / CSE 121 Discussion Session Week 2 - Fall 2007 Instructor: Michele Rousseau TA: Rosalva Gallardo.
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
Debugging applications, using properties Jim Warren – COMPSCI 280 S Enterprise Software Development.
© 2012 LogiGear Corporation. All Rights Reserved Robot framework.
Author: Loh Jianxiong Christopher Editors: Chua Jie Sheng, Li Mengran, Peh Shao Hong, Oo Theong Siang.
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Appendix E The EZJava.
CSC 216/001 Lecture 4. Unit Testing  Why is it called “unit” testing?  When should tests be written?  Before the code for a class is written.  After.
CPSC1301 Computer Science 1 Overview of Dr. Java.
Debugging Dwight Deugo Nesa Matic
Debugging. 2 © 2003, Espirity Inc. Module Road Map 1.Eclipse Debugging  Debug Perspective  Debug Session  Breakpoint  Debug Views  Breakpoint Types.
Welcome To Eclipse. Basic Concepts Workspace – directory where your projects are stored –Projects grouping of related works –Resources generic term to.
9/2/ CS171 -Math & Computer Science Department at Emory University.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of The Eclipse debugger.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
Eclipse 24-Apr-17.
1 CSC/ECE 517 Fall 2010 Lec. 3 Overview of Eclipse Lectures Lecture 2 “Lecture 0” Lecture 3 1.Overview 2.Installing and Running 3.Building and Running.
Data Display Debugger (DDD)
Eclipse. An IDE is an Integrated Development Environment Different IDEs meet different needs BlueJ, DrJava are designed as teaching tools Emphasis is.
JUnit A framework which provides hooks for easy testing of your Java code, as it's built Note: The examples from these slides can be found in ~kschmidt/public_html/CS265/Labs/Java/Junit.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 4 Slide 1 Slide 1 What we'll cover here l Using the debugger: Starting the debugger Setting.
1 CSC 216 Lecture 3. 2 Unit Testing  The most basic kind of testing is called unit testing  Why is it called “unit” testing?  When should tests be.
TOOLS FOR DESIGN AND DEVELOPMENT ENVIRONMENTS. Case study - ECLIPSE Lecture notes 5.
Justin Bare and Deric Pang with material from Erin Peach, Nick Carney, Vinod Rathnam, Alex Mariakakis, Krysta Yousoufian, Mike Ernst, Kellen Donohue Section.
Eclipse 27-Apr-17.
Netbeans QuickStart. Creating a project File->New Project –For now you want General->Java Application –Then fill in the project details.
Editing and Debugging Mumps with VistA and the Eclipse IDE Joel L. Ivey, Ph.D. Dept. of Veteran Affairs OI&T, Veterans Health IT Infrastructure & Security.
Using Ant in Eclipse Dwight Deugo Nesa Matic
Debugging using By: Samuel Ashby. What is debugging?  A bug is an error in either a program or the hardware itself.  Debugging is first locating and.
Java IDE Dwight Deugo Nesa Matic
An Introduction to Ant. What is Ant? How do you use it? Why would you want to?
1 Using an Integrated Development Environment. Integrated Development Environments An Integrated Development Environment, or IDE, permits you to edit,
Debugging with Eclipse
Appendix A Barb Ericson Georgia Institute of Technology May 2006
ATS Application Programming: Java Programming
Appendix A Barb Ericson Georgia Institute of Technology May 2006
Debugging Dwight Deugo
Testing and Debugging.
gdb gdb is the GNU debugger on our CS machines.
Microsoft Access Illustrated
Important terms Black-box testing White-box testing Regression testing
Eclipse 20-Sep-18.
Important terms Black-box testing White-box testing Regression testing
Overview of Eclipse Lectures
Debugging with Eclipse
DEBUGGING JAVA PROGRAMS USING ECLIPSE DEBUGGER
Debugging Dwight Deugo
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Eclipse JUnit Testing make and ant
Code Composer Essentials 3.0
Debugging with Eclipse
Workshop for Programming And Systems Management Teachers
Presentation transcript:

Programming Tools Eclipse JUnit Testing make and ant

Spring 2010CS 2252 Development Environments Command line –gvim/emacs –javac –java Integrated Development Environment –provides access to all the tools from a single interface –Eclipse (3.3.2)

Spring 2010CS 2253 Eclipse "universal tool platform" Developed by IBM –Now an open source project Primarily a development environment for Java –written in Java –Extendible Plug-ins can be added to support new functionality and other languages

Spring 2010CS 2254 Eclipse Workbench Provides the basic graphical interface Divided up into views –Navigator shows all projects –Editor has panes for all open files Views are organized into perspectives –a perspective contains a set of views that are needed for a particular task Java perspective debug perspective

Spring 2010CS 2255 Command Line Arguments in Eclipse To use command-line arguments, you need to create a Run Configuration for the project. From the Run menu (or the Run drop-down), select Open Run Dialog Create a new Run Configuration (or modify an existing on for the project) –Click the Arguments tab –Type the desired command-line arguments into the Program Arguments text box –Click Apply and then Run

Spring 2010CS 2256 IO Redirection in Eclipse Append the redirection operators to the command-line arguments Create a script to use as an external tool

Spring 2010CS 2257 JUnit Testing JUnit is an open-source testing framework for Java –facilitates the writing of test cases You can create test cases and test suites by extending the appropriate class from the JUnit package

Spring 2010CS 2258 JUnit Testing JUnit has been integrated into Eclipse Make sure junit.jar is on the build path –use the Properties menu –or let Eclipse find it when you create the test case Create a test case –File -> New -> JUnit Test Case Run your application as a JUnit Test

Spring 2010CS 2259 In the TestCase class Write methods that test each of the methods of your class –use the assertion methods on next slide for testing results of methods You can override setup() and teardown() to create a set of objects to be shared by several tests

Spring 2010CS Assertion methods assertEquals( expected, actual) for primitives assertFalse( condition), assertTrue(condition) assertNull( object), assertNotNull( object) assertSame( ecpected, actual), assertNotSame(expected, actual)

Spring 2010CS Sources of Information The home page for JUnit is at The documentation is at

Spring 2010CS Debugging Compile time –Compiler forces your code to have correct syntax Run time –How do you figure out what is wrong with a program that isn't running correctly? –What information do you need?

Spring 2010CS Debuggers A debugger is a tool that is designed to help you figure out what is going wrong in a program. Useful functionality –Start the program and have it stop just before where you think the error occurs –Look at (and modify) variable values –Look at the call stack –Step through parts of the program one line at a time

Spring 2010CS Debugging in Eclipse The debug perspective provides the views needed for debugging. –Debug view –Variable View –Breakpoints view –Expressions view –Editor view –Outline and Console views are the same as in the java perspective

Spring 2010CS Debug View Shows stack frames for any programs currently being debugged Buttons allow you to –Resume - start from current instruction and continue to next breakpoint or end of program –Suspend (e.g. for infinite loop) –Terminate stops the program –Remove all terminated launches

Spring 2010CS Editor View Essentially the same as in the Java perspective Breakpoints are marked at the edge of the frame –Left click and select toggle breakpoint An arrow marks the next statement to execute Hovering mouse over a variable name will show its value

Spring 2010CS Breakpoints A breakpoint is used to mark lines of code where you want the program to stop. –Once the program stops, you can examine all the variables Breakpoint view shows all breakpoints and allows you to manage them –Disable, enable, remove, remove all

Spring 2010CS Other kinds of Breakpoints Watchpoints - suspend when the program is going to change an instance variable –Run-> Add/Remove Watchpoint Method breakpoints - suspend on entry to or exit from a method –Run-> Add/Remove Method Breakpoint Exception breakpoints - suspend on a particular Exception –Run-> Add/Remove Exception Breakpoint

Spring 2010CS More on Breakpoints You can set breakpoints with hit counts –program stops when the breakpoint has been reached the specified number of times –Right-click on the breakpoint in the breakpoint view You can also set a breakpoint to trigger –when a variable changes –when a Boolean expression is true

Spring 2010CS Stepping through code Step into goes into the code of a method that is being called Step over executes the entire method call Step return completes the current method call –Stops at breakpoints or at the point from which the method was called

Spring 2010CS Values and Expressions Double clicking on a variable in the Variable view allows you to change its value –new value is used when the program resumes Type an expression into the Expression view to find out what its value is

Spring 2010CS UML Diagrams Class diagrams Object diagrams Tools –dia –umbrello –violet

Spring 2010CS UML Class Diagrams Used to illustrate relationships between classes Used to show the details of a particular class

Spring 2010CS UML Symbols SymbolVisibility +public -private #protected ~package RelationshipConnector inheritance (is-a) open arrow association (uses) solid line aggregation/ composition (has-a) open/ solid diamond inner classcircle with cross

Spring 2010CS Inheritance

Spring 2010CS Class Hierarchy

Fall 2007CS UML Class Diagram

Fall 2007CS UML Object Diagram Used to represent the state of the program at some particular time

Spring 2010CS Tools for UML Diagrams dia umbrello violet Eclipse plug-in

Spring 2010CS Building Big Projects For very large projects, the process of recompiling all the modules that make up the project can take a long time. One way to reduce the amount of time needed to build a project is to only recompile the modules that have not changed and don't use modules that have changed. Two tools that determine what needs to be recompiled. –make –ant (for Java)

Spring 2010CS The make Utility make is a command generator designed to help you manage large projects –make allows you to specify dependencies between modules if a class depends on another class, it should be recompiled when that class changes –make allows you to specify how to compile a particular class –make uses these specifications to determine the minimum amount of work needed to recompile a program

Spring 2010CS How does make Work? make uses a file called Makefile (or makefile or GNUMakefile) to determine what needs to be recompiled. The makefile contains a set of rules for executing the jobs it can be asked to do. When you run make, it uses the rules in the makefile to determine what needs to be done. make does the minimum amount of work needed to get the job done.

Spring 2010CS The Makefile A make file consists of a set of rules Each rule has the form target: dependencies commands target is (usually) the name of a file to be created dependencies are the names of files that are needed to create the target commands is one or more commands that need to be executed to create the target. Each command is indented with a tab

Spring 2010CS Example TestPriorityQueue uses KWPriorityQueue. PrintDocument and ComparePrintDocuments objects ComparePrintDocuments uses PrintDocument objects KWPriorityQueue implements Queue

Spring 2010CS makefile TestPriorityQueue.class: TestPriorityQueue.java \ KWPriorityQueue.class PrintDocument.class \ ComparePrintDocuments.class javac TestPriorityQueue.java KWPriorityQueue.class: KWPriorityQueue.java Queue.class javac KWPriorityQueue.java Queue.class: Queue.java javac Queue.java

Spring 2010CS makefile (cont.) ComparePrintDocuments.class: \ ComparePrintDocuments.java PrintDocument.class javac ComparePrintDocuments.java PrintDocument.class: PrintDocument.java javac PrintDocument.java

Spring 2010CS Dummy targets The makefile can also have targets that don’t create files A target to run a java program TestPriorityQueue: TestPriorityQueue.class java TestPriorityQueue A target to remove class files clean: rm -f *.class

Spring 2010CS Sources of Information Managing Projects with make by Andrew Oram and Steve Talbot make_toc.htmlhttp:// make_toc.html Look at the man page man make

Spring 2010CS Ant make can be used with Java files ant was designed for building large Java projects –acronym for "Another Neat Tool" Ant uses XML format for build files

Spring 2010CS build files A build file is an xml file that contains exactly one project element main is target to build if none is given name and basedir are optional attributes for project

Spring 2010CS Targets A project element contains one or more targets Each target corresponds to a task –the main target is required depends attribute contains list of targets that this target needs

Spring 2010CS Tasks Each target contains one or more tasks There are a number of built-in tasks –java needs the classname attribute to be set to the main class –javac –jar - to create a java archive –javadoc - to create the documentation

Spring 2010CS Sources of Information Ant The Definitive Guide by Steve Holzner Ant is an open source Apache project –