(Test Driven) Software Development

Slides:



Advertisements
Similar presentations
PHP Reusing Code and Writing Functions.
Advertisements

Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
1 The Database Application Development Process The Database Application Development Process.
E-commerce Project Erik Zeitler Erik Zeitler2 Lab 2  Will be anounced and scheduled later  We will deploy Java Server Pages on a Tomcat server.
Testing an individual module
Test-Driven Development Gary Brown Building better software one test at a time.
By John Boal  Continuous Integration [CI] ◦ Automating the build process ◦ Build the entire system each time any new.
28/08/2015SJF L31 F21SF Software Engineering Foundations ASSUMPTIONS AND TESTING Monica Farrow EM G30 Material available on Vision.
Sage CRM Developers Course
System Analysis & Design Introduction: System Analysis and design course intents to help students understand its importance in developing systems that.
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
@benday #vslive Automated Build, Test & Deploy with TFS, ASP.NET, and SQL Server Benjamin
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
INTRODUCTION TO DATABASES Chapter 1. What is a Database?  Forget the glossary! (see pages 11-12)  The purpose of a database is to help people track.
CS3300 Fall 2015 Software Development Lifecycles.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
Software Construction Lecture 18 Software Testing.
An Architectural Review of TAKEaTEST.Net Southern California Code Camp California State University, Fullerton January 21-22, 2006 Ben Aminnia Pointer Corporation.
Whistle Stop Tour of The Module. This is a new module!
TEST-1 6. Testing & Refactoring. TEST-2 How we create classes? We think about what a class must do We focus on its implementation We write fields We write.
Finding a PersonBOS Finding a Person! Building an algorithm to search for existing people in a system Rahn Lieberman Manager Emdeon Corp (Emdeon.com)
Mr C Johnston ICT Teacher
Ivar Jacobson, Grady Booch, and James Rumbaugh The Unified Software Development Process Addison Wesley, : James Rumbaugh's OOMD 1992: Ivar Jacobson's.
(1) Test Driven Development Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii Honolulu.
Refactoring1 Improving the structure of existing code.
Test Driven Development Introduction Issued date: 8/29/2007 Author: Nguyen Phuc Hai.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Software Engineering Lecture 11 Software Testing Presenter: Josef Hallberg 1.
Agile Development VS 2005 Team vs. Open Source Toolkit Michael Gillespie James Brown Agillence Software Inc.
Information Systems Development
CS223: Software Engineering
SaralTA Batch-07 Software Testing Presented By - Chittaranjan M.
“When quality is critical"
Unit Testing - solid fundamentals
Testing Verification and the Joy of Breaking Code
Test-Driven Development
Design Components are Code Components
Software Testing.
N-Tier Architecture.
Test Driven Development 1 November Agenda  What is TDD ?  Steps to start  Refactoring  TDD terminology  Benefits  JUnit  Mocktio  Continuous.
Chapter 8 – Software Testing
COMPSCI210 Recitation 12 Oct 2012 Vamsi Thummala
Some Simple Definitions for Testing
Testing & Testing Tools
Application Development Theory
CO6025 Advanced Programming
Overview of System Engineering
Cookies BIS1523 – Lecture 23.
Introduction to JavaScript
Teaching slides Chapter 9.
Chapter 10 Programming Fundamentals with JavaScript
More Selections BIS1523 – Lecture 9.
A second look at JavaScript
Conditions and Ifs BIS1523 – Lecture 8.
Testing and Test-Driven Development CSC 4700 Software Engineering
Improving the structure of existing code
Computer Science Testing.
CS 8532: Advanced Software Engineering
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Design Components are Code Components
2/18/2019 E-commerce Project Minpeng Zhu.
Software Engineering Practice: A Generic View
2/25/2019 E-commerce Project Minpeng Zhu.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Tonga Institute of Higher Education IT 141: Information Systems
Introduction to JavaScript
Tonga Institute of Higher Education IT 141: Information Systems
Test-Driven Development
CS 325: Software Engineering
Testing Slides adopted from John Jannotti, Brown University
Presentation transcript:

(Test Driven) Software Development 11/16/2018 (Test Driven) Software Development Erik Zeitler

Dream up a business case Think of a service you want to see Figure out how to do it in a way that doesn’t suck Do it 2018-11-16 Erik Zeitler

How to do it? Think about the use cases Cut the work into pieces How will the service be used Cut the work into pieces User Interface, application code, database Assign pieces within the project group Use Test Driven Development Test each piece (unit tests) Test all pieces together (integration/regression tests) 2018-11-16 Erik Zeitler

Rapid prototyping Make a simple prototype ASAP See what new ideas it gives you ”Often, users don’t know what they want until they see it” – Steve Jobs Show your prototype to the other project groups Give feedback to each other 2018-11-16 Erik Zeitler

Three-tier architecture User Interface What should the user see? Make drawings Database What information will you keep? Do data modelling, using ER diagrams Business logic How will you present the data to the users? For any non-trivial function, do test driven development 2018-11-16 Erik Zeitler

Data modelling Keep persistent data in a database Customer information Banking information Inventory What do you carry, and how much do you have right now? Past activity What has the customer bought? What has the customer looked at? What information do you want to store? Why? Make an Entity Relationship diagram Translate the ER diagram into SQL tables 2018-11-16 Erik Zeitler

Example of an ER diagram 2018-11-16 Erik Zeitler

Why ER diagrams? ”Keep talking about the algorithms, and everyone will stay totally mystified” ”Show the ER diagram, and everything else will be obvious” 2018-11-16 Erik Zeitler

Software development is all about Getting Things Done Priorities in software development: Make it work Make it beautiful Make it fast 2018-11-16 Erik Zeitler

How? How to make it work? How to make it beautiful? First write tests, then write code. This is called Test Driven Development. How to make it beautiful? Re-factor How to make it fast? Don’t worry about performance until performance is a problem. 2018-11-16 Erik Zeitler

Why TDD? Because Because does it A test is a specification Debugging sucks Testing rocks Because does it A test is a specification The capabilities of a program is defined by its tests If the tests pass we know that the program works – for the test cases. A test is a piece of documentation 2018-11-16 Erik Zeitler

The rules of TDD are simple You can't write production code unless there is a broken test. First write a test, then write the code When there is a broken test, you change your code to make it pass. When your code is working, you refactor to eliminate any code smells… 2018-11-16 Erik Zeitler

What is code smell? ”Something is fishy about the code” http://en.wikipedia.org/wiki/Code_smell Examples: Large method A function that is > 1 page Duplicated method A method, function, or procedure that is very similar to another. Contrived Complexity Forced usage of overly complicated design patterns where simpler design would suffice 2018-11-16 Erik Zeitler

Demonstration yay 2018-11-16 Erik Zeitler

A good set of tests Covers all code performs tests on different scale How many lines of code do you have? How many lines are tested? Do you have > 90% test coverage? performs tests on different scale unit – integration – regression tests for all cases, including edge cases and errors e.g. expectException() 2018-11-16 Erik Zeitler

Different sized tests Large (regression) Medium (integration) Small (unit) isolation, speed confidence in whole system 2018-11-16 Erik Zeitler

Where is the bug? vs. ”Test failed” ”Test failed” 2018-11-16 Erik Zeitler

Does the entire system work? + vs. + + + 2018-11-16 Erik Zeitler

Tests for edge cases and errors Write tests for invalid input data, like empty strings empty data sets false broken input data what happens to your functions if they get ’a%76tr423£4’, when they expected a single character (e.g. ’a’)? Generate exceptions in production code catch exceptions in test code 2018-11-16 Erik Zeitler

Test your database Set up a test database, identical to your production database Grant privileges to your php test script Call your stored procedures from your php test script Validate the result data from the database 2018-11-16 Erik Zeitler

Further resources Soon available on the course home page: The latest PHPUnit (simpletest) These slides My demonstration examples IDEs (Eclipse, Netbeans, ...) have infrastructure for testing 2018-11-16 Erik Zeitler