CSCA48H Style and Testing. 2 Style The Zen of Python: import this Do the Goodger reading!

Slides:



Advertisements
Similar presentations
By Ethan. Time can be a unit of measurement. There are 60 second in 1 minute. There is 60 minutes in 1 hour and there are 365 days in a year. Interesting.
Advertisements

JUnit Tutorial Hong Qing Yu Nov JUnit Tutorial The testing problems The framework of JUnit A case study JUnit tool Practices.
Testing and MXUnit In ColdFusion By Denard Springle July 2011, NVCFUG.
CS0007: Introduction to Computer Programming Introduction to Classes and Objects.
Test-Driven Development and Refactoring CPSC 315 – Programming Studio.
CIT 590 Unit testing.
A Brief Introduction to Test- Driven Development Shawn M. Jones.
Ashley Holien.  Standard  Use time and money in real-world and mathematical situations.  Objectives  Students will be shown the basic concept of how.
Time 1 day = 24 hours 1 hour = 60 minutes 1 minute = 60 seconds 1 year
Composition One object is composed of other objects (e.g. Car is composed of an engine, etc.) Engine cylinders : int volume: int start() : None Car engine.
Telling Time to the Hour
Telling Time to the Hour
Test-Driven Development and Refactoring Project 3 Lecture 1 CPSC 315 – Programming Studio Fall 2009.
JUnit Syed Nabeel. Motivation Unit Testing Responsibility of  developer Rarely done properly Developers Excuse: “I am too much in a hurry”
24 Hour Clock Grade 6 Math.
Measuring Time.
Telling Time!!! Using a.m./ p.m. 24 hour clocks There are 24 hours in a day…
12 hr (analogue) clock A 12 hr clock only uses 12 numbers, as its name suggests. It uses ‘am’ and ‘pm’ to distinguish between times before midday and.
Telling Time. Why should I learn to read a clock? When we can read a clock, we can find out when it is time to do something, like meet a friend at the.
Unit Testing Using PyUnit Monther Suboh Yazan Hamam Saddam Al-Mahasneh Miran Ahmad
Test-Driven Development “Test first, develop later!” –OCUnit.
By for Test Driven Development: Industry practice and teaching tool Robert Vanderwall, Ph.D. 1 WISTPC-15.
Software Testing For CSE 3902 Matt Boggus. Terms: Setup / Exercise / Verify / Teardown Setup - whatever needs to be prepared before the code can be run.
Test Driven Development TDD. Testing ”Testing can never demonstrate the absence of errors in software, only their presence” Edsger W. Dijkstra (but it.
Testing in Extreme Programming
Programming By Intention/ Intro to JUnit. Admin ► Astels, p. 50 – “The test in the section titled Programming by Intention…” should read “The test in.
COMPSCI 101 Principles of Programming Lecture 28 – Docstrings & Doctests.
Sadegh Aliakbary Sharif University of Technology Spring 2012.
Intoduction to Unit Testing Using JUnit to structure Unit Testing SE-2030 Dr. Rob Hasker 1 Based on material by Dr. Mark L. Hornick.
© Copyright 2005, thycotic. Test Driven Development Jonathan Cogley Maryland Cold Fusion User's Group 10/11/2005.
Clear Lines Consulting · clear-lines.comSilicon Valley Code Camp 2008 · Nov 8, 2008 · 1 Test-Driven Development An introduction for C# developers.
Future Media  BBC MMXI TDD at the BBC David Craddock, Jack Palfrey and Tom Canter.
Chapter Seven Telling Time. 1.hour – a unit used to measure time 1 hour = 60 minutes 1 day = 24 hours.
Telling time Ms. Einspahr’s 2 nd grade class Types of Clocks.
Who Wants to be a Millionaire? Type your name and send
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Let’s Tell Time!. What is Time made up of? A.M. Between midnight and afternoon P.M. Between noon and midnight.
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.
Time pm10 pm9 pm8 pm7 pm6 pm5 pm4 pm3 pm2 pm1 pmmidday
Measuring Elapsed Time. Units of Time 1 minute (min) = 60 seconds (s) 1 hour (h) = 60 minutes 1 day = 24 h 1 week (wk) = 7 days 1 year is about 365 days.
Time Vocabulary Do you have the time to review? Analog Clock A device for measuring time by moving hands around a circle for showing hours, minutes,
2-1 By Rick Mercer with help from Kent Beck and Scott Ambler Java Review via Test Driven Development.
Unit Testing with FlexUnit
Elapsed Time How Can We Calculate How Much Time Has Gone By? April 5, 2010.
Testing Unit Testing In Evergreen Kevin Beswick Laurentian University / Project Conifer.
TIME AND CLOCK Made for third graders. LET’S LEARN ABOUT TIME There are 24 hours in a day, and these hours are divided into a.m. and p.m. a.m. meaning.
Automated Testing with PHPUnit. How do you know your code works?
SWE 434 SOFTWARE TESTING AND VALIDATION LAB2 – INTRODUCTION TO JUNIT 1 SWE 434 Lab.
TESTING TEST DRIVEN DEVELOPMENT
CIT 590 Unit testing.
Smalltalk Testing - SUnit
Test Driven Development 1 November Agenda  What is TDD ?  Steps to start  Refactoring  TDD terminology  Benefits  JUnit  Mocktio  Continuous.
Do you have the time to review?
Software Engineering 1, CS 355 Unit Testing with JUnit
Selenium HP Web Test Tool Training
Test-driven development (TDD)
Introduction To The 24-Hour Clock
Introduction to JUnit CS 4501 / 6501 Software Testing
Problem Solving: Structure Charts
Elapsed Time By Mrs. Stephanie Estes.
Twenty Questions Subject: Time.
Introduction to JUnit IT323 – Software Engineering II
Test Driven Development
Elapsed Time.
Test Driven Development
You’ll get better code in less time (If you do it for a while)
Do you have the time to review?
Testing Strategies Sources: Code Complete, 2nd Ed., Steve McConnell
Who Wants to be a Millionaire?
Presentation transcript:

CSCA48H Style and Testing

2 Style The Zen of Python: import this Do the Goodger reading!

3 Test-first development Kent Beck, a famous software engineer, created Test Driven Development (TDD): Many professional software developers write their tests first. Most others write their tests as they develop their code. Steps to TDD: Write a failing test case that uses a new function or exercises an existing one. Write just enough code to pass the test. Refactor the new code to acceptable standards.

4 A real-world observation “Let's not be pedantic. Write unit tests before you code a method, or after it - in my experience, it matters little, as long as you think about and write the tests at roughly the same time as you write the code.... In my experience, when people set out to write unit tests after the fact, they write them poorly, as an afterthought ("I've finished all the code, now I just have to write the unit tests").”

5 Testing framework? Options: nose (separate install, but doesn’t use classes) PyUnit/unittest (comes with Python!) doctest (comes with Python!) CSCA48H: we will use PyUnit:

6 PyUnit components import unittest and modules that are being tested, of course Create classes that inherit from unittest.TestCase Create methods in these classes Just like nose, test method names start with “ test ” Special methods: setUp, tearDown assertTrue, assertFalse, assertEquals, fail (or just use assert statements)

7 TDD example We want to keep objects representing clock times (with hours and minutes). The constructor only needs to handle 24-hour time, but the printable representation should be 12-hour time with “am” and “pm”, with “noon” and “midnight” as well.