Advanced Programming Behnam Hatami Fall 2017.

Slides:



Advertisements
Similar presentations
Configuration management
Advertisements

OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
Test-Driven Development. Why Testing is Important? “If you don’t have tests, how do you know your code is doing the thing right and doing the right thing?”
TEST-DRIVEN DEVELOPMENT Lecture 3. Definition Test-driven development (development through testing) is a technique of programming, in which the unit tests.
Inheritance Inheritance Reserved word protected Reserved word super
Cell phones off Name signs out – congrats Sean! CSE 116 Introduction to Computer Science for Majors II1.
JUnit. What is unit testing? A unit is the smallest testable part of an application. A unit test automatically verifies the correctness of the unit. There.
Unit 251 Implementation and Integration Implementation Unit Testing Integration Integration Approaches.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
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.
TDD Test-Driven Development. JUnit 4.0 To use annotations need to import org.junit.Test To use assertion need to import org.junit.Assert.* No need to.
Software Testing Test Design and Implementation. Agenda Test Design Test Implementation Test Design Sources Automated Testing 2.
Software Testing Verification and validation planning Software inspections Software Inspection vs. Testing Automated static analysis Cleanroom software.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 23 Slide 1 Software testing Slightly adapted by Anders Børjesson.
Unit and Functional Testing Your Flex Applications Mike Nimer Dir. Of Engineering nomee.com.
Testing Especially Unit Testing. V-model Wikipedia:
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
Sadegh Aliakbary Sharif University of Technology Spring 2012.
Software Development Software Testing. Testing Definitions There are many tests going under various names. The following is a general list to get a feel.
1 Introduction Modules  Most computer programs solve much larger problem than the examples in last sessions.  The problem is more manageable and easy.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
JavaScript Unit Testing Hanoi PHP Day
CSC 395 – Software Engineering Lecture 10: Execution-based Testing –or– We can make it better than it was. Better...faster...agiler.
Well-behaved objects Main concepts to be covered Testing Debugging Test automation Writing for maintainability Objects First with Java - A Practical.
1 Chapter 8 – Classes and Object: A Deeper Look Outline 1 Introduction 2 Implementing a Time Abstract Data Type with a Class 3 Class Scope 4 Controlling.
Advanced Programming in Java
Unit Testing with JUnit and Clover Based on material from: Daniel Amyot JUnit Web site.
JUnit Adam Heath. What is JUnit?  JUnit is a unit testing framework for the Java programming language  It allows developers to swiftly and easily test.
COMP3190: Principle of Programming Languages
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 26 - Java Object-Based Programming Outline 26.1Introduction.
By Rick Mercer with help from Kent Beck and Scott Ambler Java Review via Test Driven Development (TDD)
Sadegh Aliakbary Sharif University of Technology Spring 2011.
Classes. Constructor A constructor is a special method whose purpose is to construct and initialize objects. Constructor name must be the same as the.
Testing code COMP204. How to? “manual” –Tedious, error-prone, not repeatable “automated” by writing code: –Assertions –Junit.
Final Review. From ArrayLists to Arrays The ArrayList : used to organize a list of objects –It is a class in the Java API –the ArrayList class uses an.
Test it! Unit, mocking and in-container Meet Arquillian! Ivan St. Ivanov.
S Ramakrishnan1 Systems V & V, Quality and Standards Dr Sita Ramakrishnan School CSSE Monash University.
1 Unit Testing with JUnit CS 3331 JUnit website at Kent Beck and Eric Gamma. Test Infected: Programmers Love Writing Tests, Java Report,
Object Oriented Analysis and Design 1 Chapter 9 From Design to Implementation  Implementation Model  Forward, Reverse, and Round-Trip Engineering  Mapping.
JUnit in Action SECOND EDITION PETAR TAHCHIEV FELIPE LEME VINCENT MASSOL GARY GREGORY ©2011 by Manning Publications Co. All rights reserved.
2-1 By Rick Mercer with help from Kent Beck and Scott Ambler Java Review via Test Driven Development.
CS-2852 Data Structures LECTURE 7B Andrew J. Wozniewicz Image copyright © 2010 andyjphoto.com.
Unit Testing. F-22 Raptor Fighter Manufactured by Lockheed Martin & Boeing How many parts does the F-22 have?
Well-behaved objects Main concepts to be covered Testing Debugging Test automation Writing for maintainability Objects First with Java - A Practical.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 23 Slide 1 Software testing.
SWE 434 SOFTWARE TESTING AND VALIDATION LAB2 – INTRODUCTION TO JUNIT 1 SWE 434 Lab.
Lecture 5: Test-Driven Development Basics
Unit Testing.
Test Driven Development
Chapter 8 – Software Testing
Lecture 2 of Computer Science II
Chapter 7 Software Testing.
Software Engineering 1, CS 355 Unit Testing with JUnit
Advanced Programming Behnam Hatami Fall 2017.
Can perform actions and provide communication
Advanced Programming Fall 2017.
Can perform actions and provide communication
COS 260 DAY 16 Tony Gauvin.
Advanced Programming Behnam Hatami Fall 2017.
Advanced Programming Behnam Hatami Fall 2017.
Advanced Programming Behnam Hatami Fall 2017.
Advanced Programming Behnam Hatami Fall 2017.
Chapter 1 Introduction(1.1)
Can perform actions and provide communication
Introduction to JUnit IT323 – Software Engineering II
Advanced Programming Behnam Hatami Fall 2017.
Test Driven Development
In the Senior Design Center
Presentation transcript:

Advanced Programming Behnam Hatami Fall 2017

Review Java Programming Language Principles of Object Oriented Programming Characteristics of objects Encapsulation Objects in memory References Heap Stack Parameter Passing

Review (2) Initialization and Cleanup Access specifiers Constructor finalize() Order of initialization Initialization blocks Access specifiers Public Private Package access

Review (3) Package Static The this reference Method overloading toString() equals() Refactoring Bad smells Refactoring techniques

Agenda Software Quality Characteristic of a good software Test Unit Testing Refactoring

Quality of Product The producer should ensure about the quality of the products Quality Control Any business, any product

A Cook

In surgery

A Car Maker

Quality Control Quality should be tested A product is not finalized, before the test Different kinds of test, check different kinds of quality

Software Quality We are programmers Programmers produce software What are characteristics of a good software? Many parameters. E.g. Conformance to requirements Performance Time Memory Maintainability Changeability Different kinds of test, check different kinds of quality

Test in Other Industries Test side effects A damage to the product Test of a building Test of a car Test of a part of a product

Test Side Effects

What to do with Test Side Effects? Testing a sample of the product Simulation Mathematical analysis In software testing Along with all of these techniques And we can also test the software itself! (Usually) no damage to the software

Test Target System Test Unit Test Test the system as a whole For performance, correctness and conformance. Unit Test Test the units and modules Test of a component Test of a class Test of a method

How to Test Software Manual Test Test Tools Test Code Test Teams Try it! Test Tools Performance Test Profiling JProfiler, TPTP Load Test Jmeter Test Code Unit Tests Test Teams

Test Code Business Code Test Code The code, written for implementation of a requirement Test Code The code, written for test of an implementation

Unit Testing A process for the programmer Test of units of software Not a test team procedure For improving the code quality Reduces bugs Test of units of software before the software is completed Unit: method, class

Classical Unit Testing Writing main() method Some printlns Drawbacks?

Drawbacks Test code coupled with business code In the same class Written tests are discarded One test at a time The programmer executes the tests himself Test execution is not automatic The programmer should check the result of each test himself The test is passed or failed? The test result interpretation is not automatic

A Good Unit Test Code Repeatable Automatic Invocation Acceptance (Pass/Failure) JUnit helps you write such tests

JUnit, First Example

JUnit, The Green Bar

Assertions assertNull(x) assertNotNull(x) assertTrue(boolean x) assertFalse(boolean x) assertEquals(x, y) Uses x.equals(y) assertSame(x, y) Uses x ==y assertNotSame fail()

Annotations @Test @Before @After @BeforeClass @AfterClass

A Good Unit Test is Automated Through Repeatable Independence Professional

Test Driven Development Test First Development Before writing a code, write the tests!

TDD

References Java How to Program (9th Edition) Deitel & Deitel Thinking in Java (Fourth Edition) Bruce Eckel Java cup

Any Question