TDD elaborate 2011-06-10. 들어가기 전에 … This is not a whole story of TDD. This is not a whole story of developing Actually, there is no neat end of developing.

Slides:



Advertisements
Similar presentations
Bowling Game Kata Object Mentor, Inc. fitnesse.org Copyright 2005 by Object Mentor, Inc All copies must retain this page unchanged.
Advertisements

Code Review as a Great Tool in the Agile Toolbox Matthias Sohn, Stefan Lay (SAP)
Unit Testing Australian Development Centre Brisbane, Australia.
xUnit Test Patterns (Some) xUnit Test Patterns (in practice) by Adam Czepil.
(Advanced) Web Application Development Test Driven Development with Ruby and Rails Bruce Scharlau, University of Aberdeen, 2013.
Practice Session 5 Java: Packages Collection Classes Iterators Generics Design by Contract Test Driven Development JUnit.
Lecture 4 Basic Scripting. Administrative  Files on the website will be posted in pdf for compatibility  Website is now mirrored at:
Computer Science 209 Testing With JUnit. Why Test? I don ’ t have time, I ’ ve got a deadline to meet The more pressure I feel, the fewer tests I will.
Automated Testing with Sitecore V2
Extreme Programming Programming Practices Object Mentor, Inc. Copyright  by Object Mentor, Inc All Rights Reserved Portions of this material.
A Brief Introduction to Test- Driven Development Shawn M. Jones.
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?”
Unit and Functional Testing with JUnit and Related Tools Greg Barnes University of Washington
NAUG NAUG Knowledge Evening – th February 2007.
EXtreme.NET Dr. Neil Roodyn. eXtreme.NET Who is Dr. Neil? MISSION: To increase the value of your Software Business Working with software for way too long.
Agile Testing with Testing Anywhere The road to automation need not be long.
Big Projects  Part of this class is about picking a cool software project and building it 1.
Test Driven Development Derived from Dr. Fawcett’s notes Phil Pratt-Szeliga Fall 2009.
By: Taylor Helsper.  Introduction  Test Driven Development  JUnit  TDD Example  Conclusion.
CASE Tools And Their Effect On Software Quality Peter Geddis – pxg07u.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
M Gallas CERN EP-SFT LCG-SPI: SW-Testing1 LCG-SPI: SW-Testing LCG Applications Area GridPP 7 th Collaboration Meeting LCG/SPI LCG.
© BJSS Limited Going Agile UK TMF - April 2011 Mark Crowther, Test Consultant.
Agile and XP Development Dan Fleck 2008 Dan Fleck 2008.
Software Engineering 2003 Jyrki Nummenmaa 1 CASE Tools CASE = Computer-Aided Software Engineering A set of tools to (optimally) assist in each.
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.
Coming up: What is Agile? XP Development Dan Fleck 2010 Dan Fleck 2010.
October, 2006 © Copyright 2006, Larry A. Beaty. Copying and distribution of this document is permitted in any medium, provided this notice is preserved.
Sofia Bulgaria Summer School IST eXPERT: Best Practice on e-Project Development 30 June - 2 July 2003 eXtreme programming.
Software Construction Lecture 18 Software Testing.
A Practical Guide To Unit Testing John E. Boal TestDrivenDeveloper.com.
1-1 1) Software Development 2) with TDD at the end By Rick Mercer with help from these sources: Rational Unified Process Computing Fundamentals with C++,
Process Presentation Kin Wan Li, Ashley Zoch, Mevesh Gopee, Damian Ridgwell, Edwin Lusala,
Unit Testing with JUnit and Clover Based on material from: Daniel Amyot JUnit Web site.
1 Legacy Code From Feathers, Ch 2 Steve Chenoweth, RHIT Right – Your basic Legacy, from Subaru, starting at $ 20,295, 24 city, 32 highway.
A tool for test-driven development
Simple Java Unit Testing with JUnit 4 and Netbeans 6.1 Kiki Ahmadi JUG-Bonek.
Week81 APCS-AB: Java Unit Testing Information today from “Unit Testing in BlueJ” October 28, 2005.
M Gallas CERN EP-SFT LCG-SPI: SW-Testing1 LCG-SPI: SW-Testing QMTest test framework LCG AppArea meeting (16/07/03) LCG/SPI LCG Software.
CSCA48H Style and Testing. 2 Style The Zen of Python: import this Do the Goodger reading!
By Rick Mercer with help from Kent Beck and Scott Ambler Java Review via Test Driven Development (TDD)
JUnit Don Braffitt Updated: 10-Jun-2011.
Using Loops. Goals Understand how to create while loops in JavaScript. Understand how to create do/while loops in JavaScript. Understand how to create.
Scalatest. 2 Test-Driven Development (TDD) TDD is a technique in which you write the tests before you write the code you want to test This seems backward,
1 Presentation Title Test-driven development (TDD) Overview David Wu.
2-1 By Rick Mercer with help from Kent Beck and Scott Ambler Java Review via Test Driven Development.
(1) Test Driven Development Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii Honolulu.
Introduction to Django #2Introduction to Django #2 SPARCS `08 서우석 (pipoket) `09 Summer SP ARCS Seminar`09 Summer SP ARCS Seminar.
Unit Testing. F-22 Raptor Fighter Manufactured by Lockheed Martin & Boeing How many parts does the F-22 have?
Test Driven Development Introduction Issued date: 8/29/2007 Author: Nguyen Phuc Hai.
Software Design– Unit Testing SIMPLE PRIMER ON Junit Junit is a free simple library that is added to Eclipse to all automated unit tests. The first step,
Tools for Automated Testing Presented by: Žygimantas Mockus.
Today protected access modifier Using the debugger in Eclipse JUnit testing TDD Winter 2016CMPE212 - Prof. McLeod1.
421 Review Questions 1.Does software engineering add documentation that slows down the project? 2.Is there one software process that is better than the.
/16 Final Project Report By Facializer Team Final Project Report Eagle, Leo, Bessie, Five, Evan Dan, Kyle, Ben, Caleb.
Automated Testing with PHPUnit. How do you know your code works?
Coming up: What is Agile? XP Development Dan Fleck 2010 Dan Fleck 2010.
SWE 434 SOFTWARE TESTING AND VALIDATION LAB2 – INTRODUCTION TO JUNIT 1 SWE 434 Lab.
Topic 2: Hardware and Software
Unit Testing.
Don Braffitt Updated: 26-Mar-2013
More JUnit CS 4501 / 6501 Software Testing
Software Engineering 1, CS 355 Unit Testing with JUnit
Test Driven Development
History, Characteristics and Frameworks
TDD adoption plan 11/20/2018.
Test-driven development (TDD)
TDD & ATDD 1/15/2019.
Test-Driven Development
Presentation transcript:

TDD elaborate

들어가기 전에 … This is not a whole story of TDD. This is not a whole story of developing Actually, there is no neat end of developing :P

필요성 보통 개발을 한다면,,, – 우선 중요한 기능을 다 짜보고 – 간단하게 실행해보고 – 예외 케이스들에 대한 처리 생각해보고 – 버그가 있으면 고친다 printf, print, system.out.println, print_r …… 오랜 시간 동안 스스로 자아성찰을 하게 된다 ( 나는 왜 코드를 이렇게 짰을까 ……) 문제가 어디가 있는지 찾기 어렵다 고친 다음 혹시 부작용이 있지는 않을까 걱정을 한다 (A 를 고치면 B 가 안되고 B 를 고치면 C 가 안되고 C 를 고치면 A 가 안되고 …) 즉, 어디까지 보장된 실행을 하는지 가늠하기 쉽지 않다 알 수 없는 기능이 만들어 지거나, 코드가 산으로 바다로 우주로 우주 밖으로 !

이런 거 싫다 자기를 탓하게 되고 성취감이 떨어지더라 기능 구현 보다는 개발 시간에 집착한다 중간에 잘 하고 있는지 알기 어렵다 필요 이상의 구현을 하고 있다 결론 : 생각이 많아진다

그렇다면, 개발 방법을 다르게 할 수는 없을까 ? 결국 사용하는 것 사용자. 그렇다면 오히려 개발을 주도하는 것은 개발자의 생각이 아 니고 사용자의 사용 방식이 아닐까 – 틀린 말은 아닌 것 같다. 그래 그럼 새로운 개 발 방법을 익히자 !

What is TDD? Test Driven Development – It is a Software Development Process – Family of Agile Key words – Automated unit tests – Assertions – Refactoring – Writing a code

Be careful! TDD is not an omniscience technique! – Usually, imported as part of process However, if you decided, please keep it during development

TDD Process A Process cycle is composed in 4-5 stages – Adding a test – Running a test and check – Writing code – Testing again – Refactoring the code

Process Diagram Refactoring

좀 더 쉽게 고객 ( 실질 사용자 ) 와 함께 TODO List 를 만든다 – Backlog 를 만든다는 말을 여기서 쓸 거다 나에게 적당한 일을 고른다 TDD 과정을 타면서 열심히 개발을 한다 다 되었으면 저장소에 반영하고 Review 를 받는다 위 3 과정을 TODO List 가 빌 때까지 반복한다 프로그램 개발이 끝났다

Good to Frameworks! JUnit (Java unit test framework) Python unit test module – import unittest Django unit test module – from django.utils import unittest A lot of unit testing frameworks – xUnit is a general term for unit test frameworks What relation?

잠깐 ! What is Agile? What is Unit test? What is Assertion? What is Refactoring? What is Framework?

Agile A group of software development – – Break tasks into Short term work Cross function, self organizing – 모두가 다같이 같은 위치에서 개발을 Face to Face communication Customer Representatives Each routine should make working software For a short term project – not a 10 year project, over 50 people project – Matched to the current trend of software development

All right.. Let’s see examples – Bowling Scoring Program (Java with Junit) – 학점을 계산합시다 (Python with Django test)

Bowling Score Do you like bowling? Have you ever have a question about how bowling score is graded? – I didn’t know until this seminar…

Bowling keyword Frame Game Throw Understandable??? Spare Strike

Start of thinking What can happen in Bowling Game? When a ball is thrown – add knock downed pins Want to know score of a frame Want to total score of a current game

Thinking of Tests Start of thinking Test Cases – Adding score – Getting Score Of a Frame – Getting Total score

Write test codes public void testGameStart() { Game g = new Game(); assertEquals(0, g.getScoreOfFrame(0)); assertEquals(0, g.score()); } public void testThrowOnce() { setUp(); game.add(5); assertEquals(5, game.score()); } Understandable??? public void testThrowTwice() { setUp(); game.add(5); game.add(6); assertEquals(11, game.score()); } Any question???

More test codes public void testThrowWithSpare() { setUp(); game.add(3); game.add(7); game.add(6); game.add(2); assertEquals(16, game.getScoreOfFrame(1)); // (6) } public void testThrowWithStrike() { setUp(); game.add(10); game.add(7); game.add(1); assertEquals(18, game.getScoreOfFrame(1)); // 10 + (7+1) } Understandable??? Any question???

Practice Let’s see Eclipse We will cover there – Quite lots of explanation would be given

학점을 계산합시다 괜찮아 보이는 스토리를 못 짜겠다 ( 미안 ) 규칙 설명 : – Sigma ( 학점 * 점수 ) / Sigma( 학점 )

Specification Web based 학점 계산하기 – Users would have simple Interface 과목수를 받고, (input) 과목과 점수를 입력한 다음 (get) 평점을 내준다 (result) – Django 를 쓴다 – 모든 과목의 학점은 3 학점이라 치자

Like this! A+ A0 A- …… ……

Start Django You already know – django-admin startproject gpa – django-admin startapp input – django-admin startapp get – django-admin startapp result – I know it is redundant work

Thinking of Tests Right inputs Right formats and values of POST, GET Right Result of GPA

Practice Let’s see vim We will cover there It seems to be easy, huh? – But, there would be quite a lot of explanation

This not end!!!

Category of Tests Authentication Test DB Test HTTP Test …… Everything can be tested and should be tested

Be Careful again Don’t be afraid of Failing Tests! – Fail is mother of pass?!?! Be thoughtful when you writing a Test Don’t think whole at once Don’t make testing lead you, you must lead the tests!

Please Study hard! 여러분 것이 지금까지 본건 TDD 의 극히 일부분, framework 이 제공해 주는 것의 반의반의반 (1/8) 도 안 썼다 반드시 각각에 대한 문서를 읽어보자 – Reference 는 끝 페이지

It Looks Hard No, it’s not that hard I just make it verbose to show you – This seminar is not that practical Always, first time is hard – More trials, more easy work

Keep it mind Homework – I will check if there are test cases in your mini-project next week – Be prepared!

Q&A Thanks – Special thanks to Combacsa

Reference