BlueJ Tester By Pepper.

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

Data Structures Static and Dynamic.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
1 CSCI N305 C Language Programming Welcome to CSCI N305! Compiling Your First Program Using Microsoft Visual Studio 2008.
JAVA BASICS SYNTAX, ERRORS, AND DEBUGGING. OBJECTIVES FOR THIS UNIT Upon completion of this unit, you should be able to: Explain the Java virtual machine.
Introduction to Object-Oriented Programming CS 21a: Introduction to Computing I First Semester,
How to… Keep your character from leaving the game (never to return)
JUnit, Revisited 17-Apr-17.
JUnit. Why is testing good? Due to psychological factors, programmers are bad testers. A computer can test much faster than a human Philosophy: “If it.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
DeltaV Sequence Function Block Tutorial. Introduction For this tutorial, you will gain some skill at building a discrete control function. Our objective.
Creating FrontPage Tasks The task view allows you to add information about what you want to accomplish when creating your Web site.
2013.  Reconcile your checking account  Create bank reconciliation reports  Find errors during reconciliation  Correct errors found during reconciliation.
CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
BETTER MANAGING OUR TIME KRONOS TIMEKEEPER SCHEDULING TRAINING YMCA OF METROPOLITAN DALLAS August 30, 2015.
From BlueJ to NetBeans SWC 2.semester.
Modular Programming Chapter Value and Reference Parameters t Function declaration: void computesumave(float num1, float num2, float& sum, float&
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
1 Documenting Your Project. 2 Documenting your Project Insert Banner Comments in your code Comment - coding statement used by humans not the compiler.
Modular Programming Chapter Value and Reference Parameters computeSumAve (x, y, sum, mean) ACTUALFORMAL xnum1(input) ynum2(input) sumsum(output)
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
© 2008 General Parts International, Inc. Written permission is required to copy or forward to anyone other than the intended recipient. TeammateTime DC.
Classes CS 21a: Introduction to Computing I First Semester,
ITI 1120 Lab #7. Agenda Topics in this lab: –Methods & Arrays –Library classes –Testing (JUnit) –Strings In this lab, you are going to create your own.
142 F -1 Functions chapter 3 of the text int main(void) { double x,y,z; … x = cube(y/3.0); … printf(“%f cubed is %f”,x,cube(x)); … return 0; } double cube(double.
Java Classes. Consider this simplistic class public class ProjInfo {ProjInfo() {System.out.println("This program computes factorial of number"); System.out.println("passed.
CSE 232: C++ Programming in Visual Studio Graphical Development Environments for C++ Eclipse –Widely available open-source debugging environment Available.
Mixing integer and floating point numbers in an arithmetic operation.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
A tool for test-driven development
Character Encoding & Handling doubles Pepper. Character encoding schemes EBCDIC – older with jumps in alphabet ASCII 1967 (7 bit)– Handled English, –ASCII.
Lesson 2: Reading a program. Remember: from yesterday We learned about… Precise language is needed to program Actors and Classes Methods – step by step.
Adding to an existing Household 1Adding to an existing household.
Compiling and running Java programs with BlueJ. Successfully compiled files program files in BlueJ You can tell from the shade of a program icon in BlueJ.
Reading input from the console input. Java's console input The console is the terminal window that is running the Java program I.e., that's the terminal.
Session 2: Basic HTML HTML Coding Spring 2009 The LIS Web Team Presents.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
Unit Testing. F-22 Raptor Fighter Manufactured by Lockheed Martin & Boeing How many parts does the F-22 have?
Word Lesson 2 Basic Editing © 2009 M and K Solutions, LLC -- All Rights Reserved.
Kronos Information for DU Supervisors: Removing and Modifying Approved Leave Time.
© Peter Andreae Java Programs COMP 102 # T1 Peter Andreae Computer Science Victoria University of Wellington.
Netbeans QuickStart. Creating a project File->New Project –For now you want General->Java Application –Then fill in the project details.
Bank Reconciliation Chapter 4. PAGE REF #CHAPTER 4: Bank Reconciliation SLIDE # 2 Objectives Reconcile your checking Create bank reconciliation reports.
Java 5 Class Anatomy. User Defined Classes To this point we’ve been using classes that have been defined in the Java standard class library. Creating.
Create a Quiz call it Moodle and give it a summary paragraph.
The eclipse IDE IDE = “Integrated Development Environment”
Tutorial 1 – Creating a Document
Unit Testing.
Lecture 2 D&D Chapter 2 & Intro to Eclipse IDE Date.
Testing Verification and the Joy of Breaking Code
Lecture 3 John Woodward.
CS1101X Programming Methodology
Game Extras Pepper.
Eclipse Navigation & Usage.
Testing and Debugging.
By Sanjay and Arvind Seshan
Microsoft Office Illustrated
Intro to Java.
Important terms Black-box testing White-box testing Regression testing
Important terms Black-box testing White-box testing Regression testing
Tonga Institute of Higher Education
BlueJ Tester By Pepper.
BlueJ: a very quick introduction
CS 240 – Advanced Programming Concepts
Lesson 2: Cell References
Java Programming with BlueJ Objectives
Classes CS 21a: Introduction to Computing I
Joel Adams and Jeremy Frens Calvin College
Presentation transcript:

BlueJ Tester By Pepper

What is Tester? Tester makes it easy for you to run test cases through your method that returns a value. You code the test cases You run the one test It reports all failures with expected vs actual

Why use tester Unit testing Regression testing Alternatives: When you can count on a function working, it is makes debugging the main program easier It is easier to fix a smaller amount of code Regression testing Guard against changes breaking code Alternatives: Call method frequently typing in values (if value can be entered through BlueJ interface) Code tests in main method (and verify results and print notices for failure)

Test a Static Method’s Return Right click on class box – create test class Double click green unit test box to edit Remove extends junit.framework.TestCase import tester.*; public class MyPgmTest {

Test a Static Method’s Return Fill in testSomething method 3 parts: Command : t.checkExpect Method call: MyPgm.addIt(3) Method return: 6 t.checkExpect( MyPgm.addIt(3) , 6 ); Make many tests t.checkExpect(MyPgm.addIt(3),6); t.checkExpect(MyPgm.addIt(5),5);

Complete Test Program import tester.*; public class MyPgmTest { public static void testEverything () { Tester.run (new MyPgmTest()); } public void testSomething (Tester t) { t.checkExpect (MyPgm.addIt(2),5); t.checkExpect (MyPgm.addIt(2),4);

Run Tests Right click on test block and compile Right click on test block and run testEverything() See the results of each test in the terminal window Note: You can add other methods if you like

Testing Double Value Matching How to represent 1.1? The problem: between 1/8 and 1/16 1.10011001100110011001101 × 2-4 .000110011001100110011001101

More information for doubles More on float and doubles: http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html Explains how values are held Explains rounding rules No need to learn how, just know to expect it slightly off with tolerance .001

Inexact - Checking Doubles Check doubles by only insisting on .001 tolerance. 4 parts: Command : t.checkInexact Method call: MyPgm.addIt(3) Method return: 6 Tolerance: .001 t.checkInexact( MyPgm.addIt(3) , 6, .001 );

Summary Use tester for unit and regression tests of methods with return values Doubles (and float) are inexact storage of fractions, so expect tolerance needed How to set up tests for exact and inexact How to run tests How to see results