SlideShare ist ein Scribd-Unternehmen logo
1 von 15
TDD – Test Driven Development

            Quang Nguyen Ba
            Software




                              www.hyperlogy.com
Contents

   What is Test Driven Development (TDD)
   Red/Green/Refactor Concepts
   TDD Programming Tasks
   TDD Benefits
   .NET Examples
   TDD Tools




                                        www.hyperlogy.com
Test Driven Development

 Developed by Kend Beck
 Related to Test First
  programming concepts of XP
 Goals
  – Clean code: no less, no more,
    no duplicate.
  – Automated Test
  – Agile


                                    www.hyperlogy.com
2010 How Agile Are You? survey,




                                  www.hyperlogy.com
Test Driven Development

 TDD Rules
  – Write new code only if you first have a failing
    automated test.
  – Eliminate duplication.
 Test Types
  – Programmer Tests: Technical facing or Unit test
     • Tests are created by developer
  – Customer Tests: Business facing, acceptance test
     • Test are created by customer


                                                www.hyperlogy.com
Red/Green/Refactor

 Red
  – write a little test that doesn’t work, perhaps
    doesn’t even compile at first
 Green
  – make the test work quickly, committing whatever
    sins necessary in the process
 Refactor
  – eliminate all the duplication created in just
    getting the test to work

                                                www.hyperlogy.com
TDD Programming Tasks
1.    Write the test code.

2.    Compile the test code.
     (It should fail because you haven’t implemented anything
     yet.)

3.    Implement just enough to compile.

4.    Run the test and see it fail.

5.    Implement just enough to make the test pass.

6.    Run the test and see it pass.

7.    Refactor for clarity and to eliminate duplication.

8.    Repeat from the top.



                                                                www.hyperlogy.com
TDD Benefits

 The suite of unit tests provides constant
  feedback that each component is still
  working.
 The unit tests act as documentation that
  cannot go out-of-date
 When the test passes and the production
  code is refactored to remove duplication, it is
  clear that the code is finished, and the
  developer can move on to a new test.

                                          www.hyperlogy.com
TDD Benefits

 Test-driven development forces critical
  analysis and design
 The software tends to be better designed,
  that is, loosely coupled and easily
  maintainable
 Reduced debugging time!
 Reduced manual testing time
 Continuous Integration

                                        www.hyperlogy.com
TDD Example
 Unbounded Stack
  – Push: inserts an element onto the top
  – Pop: removes the topmost element and returns it
  – Top: operation returns the topmost element but
    does not remove it from the Stack
  – IsEmpty: returns true when there are no elements on
    the Stack




                                               www.hyperlogy.com
Unbounded Stack Test Cases
1.   Create a Stack and verify that IsEmpty is true.

2.   Push a single object on the Stack and verify that IsEmpty is false.

3.   Push a single object, Pop the object, and verify that IsEmpty is true.

4.   Push a single object, remembering what it is; Pop the object, and verify
     that the two objects are equal.

5.   Push three objects, remembering what they are; Pop each one, and
     verify that they are removed in the correct order.

6.   Pop a Stack that has no elements.

7.   Push a single object and then call Top. Verify that IsEmpty is false.



                                                                     www.hyperlogy.com
Unbounded Stack Test List
8.    Push a single object, remembering what it is; and then call Top. Verify
      that the object that is returned is the same as the one that was pushed.
9.    Push multiple objects, remembering what they are; call Top, and verify
      that the last item pushed is equal to the one returned by Top.
10.   Push one object and call Top repeatedly, comparing what is returned to
      what was pushed.
11.   Call Top on a Stack with no elements.
12.   Push null onto the Stack and verify that IsEmpty is false.
13.   Push null onto the Stack, Pop the Stack, and verify that the value
      returned is null.
14.   Push null onto the Stack, call Top, and verify that the value returned is
      null.




                                                                    www.hyperlogy.com
TDD Tools
   cpputest              NDbUnit
   csUnit (.Net)         NUnit
   CUnit                 OUnit
   DUnit (Delphi)        PHPUnit
   DBFit                 PyUnit (Python)
   DBUnit                SimpleTest
   DocTest (Python)      TestNG
   Googletest            TestOoB (Python)
   HTMLUnit               Test::Unit (Ruby)
   HTTPUnit              VBUnit
   JMock                 XTUnit
   JUnit                 xUnit.net
   Moq

                                                www.hyperlogy.com
References
 http://en.wikipedia.org/wiki/Test-
  driven_development
 http://www.agiledata.org/essays/tdd.html
 http://msdn.microsoft.com/en-
  us/library/aa730844(v=vs.80).aspx
 http://en.wikipedia.org/wiki/Kent_Beck
 Test-Driven Development: By Example (Addison-
  Wesley Professional, 2003),
 Test-Driven Development in Microsoft .NET by
  James W. Newkirk and Alexei A. Vorontsov
  ISBN:0735619484 Microsoft Press © 2004

                                         www.hyperlogy.com
Trân trọng cảm ơn!



                     www.hyperlogy.com
                         www.hyperlogy.com

Weitere ähnliche Inhalte

Was ist angesagt?

Is this how you hate unit testing?
Is this how you hate unit testing?Is this how you hate unit testing?
Is this how you hate unit testing?Steven Mak
 
Increase testability with code seams
Increase testability with code seamsIncrease testability with code seams
Increase testability with code seamsLlewellyn Falco
 
iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven DevelopmentPablo Villar
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit TestingJoe Tremblay
 
Common Challenges & Best Practices for TDD on iOS
Common Challenges & Best Practices for TDD on iOSCommon Challenges & Best Practices for TDD on iOS
Common Challenges & Best Practices for TDD on iOSDerek Lee Boire
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinSigma Software
 
@LinkingNote annotation in YATSPEC
@LinkingNote annotation in YATSPEC@LinkingNote annotation in YATSPEC
@LinkingNote annotation in YATSPECWojciech Bulaty
 
Benefit From Unit Testing In The Real World
Benefit From Unit Testing In The Real WorldBenefit From Unit Testing In The Real World
Benefit From Unit Testing In The Real WorldDror Helper
 
Automating to Augment Testing
Automating to Augment TestingAutomating to Augment Testing
Automating to Augment TestingAlan Richardson
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentMireia Sangalo
 
Effective Test Driven Database Development
Effective Test Driven Database DevelopmentEffective Test Driven Database Development
Effective Test Driven Database Developmentelliando dias
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentConsulthinkspa
 
Working Effectively with Legacy Code: Lessons in Practice
Working Effectively with Legacy Code: Lessons in PracticeWorking Effectively with Legacy Code: Lessons in Practice
Working Effectively with Legacy Code: Lessons in PracticeAmar Shah
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flexmichael.labriola
 
Automating Strategically or Tactically when Testing
Automating Strategically or Tactically when TestingAutomating Strategically or Tactically when Testing
Automating Strategically or Tactically when TestingAlan Richardson
 
Wix Automation - The False Positive Paradox
Wix Automation - The False Positive ParadoxWix Automation - The False Positive Paradox
Wix Automation - The False Positive ParadoxEfrat Attas
 
Mocking in python
Mocking in pythonMocking in python
Mocking in pythonOoblioob
 

Was ist angesagt? (19)

Is this how you hate unit testing?
Is this how you hate unit testing?Is this how you hate unit testing?
Is this how you hate unit testing?
 
Increase testability with code seams
Increase testability with code seamsIncrease testability with code seams
Increase testability with code seams
 
iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven Development
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit Testing
 
Common Challenges & Best Practices for TDD on iOS
Common Challenges & Best Practices for TDD on iOSCommon Challenges & Best Practices for TDD on iOS
Common Challenges & Best Practices for TDD on iOS
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita Galkin
 
@LinkingNote annotation in YATSPEC
@LinkingNote annotation in YATSPEC@LinkingNote annotation in YATSPEC
@LinkingNote annotation in YATSPEC
 
Benefit From Unit Testing In The Real World
Benefit From Unit Testing In The Real WorldBenefit From Unit Testing In The Real World
Benefit From Unit Testing In The Real World
 
Working Effectively with Legacy Code
Working Effectively with Legacy CodeWorking Effectively with Legacy Code
Working Effectively with Legacy Code
 
Automating to Augment Testing
Automating to Augment TestingAutomating to Augment Testing
Automating to Augment Testing
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Effective Test Driven Database Development
Effective Test Driven Database DevelopmentEffective Test Driven Database Development
Effective Test Driven Database Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Working Effectively with Legacy Code: Lessons in Practice
Working Effectively with Legacy Code: Lessons in PracticeWorking Effectively with Legacy Code: Lessons in Practice
Working Effectively with Legacy Code: Lessons in Practice
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
 
Automating Strategically or Tactically when Testing
Automating Strategically or Tactically when TestingAutomating Strategically or Tactically when Testing
Automating Strategically or Tactically when Testing
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
 
Wix Automation - The False Positive Paradox
Wix Automation - The False Positive ParadoxWix Automation - The False Positive Paradox
Wix Automation - The False Positive Paradox
 
Mocking in python
Mocking in pythonMocking in python
Mocking in python
 

Andere mochten auch

Test Driven Development - For Girl Geeks Night Sydney
Test Driven Development - For Girl Geeks Night SydneyTest Driven Development - For Girl Geeks Night Sydney
Test Driven Development - For Girl Geeks Night SydneyJo Cranford
 
TDD-based workflow: Optimizing Development Process
TDD-based workflow: Optimizing Development ProcessTDD-based workflow: Optimizing Development Process
TDD-based workflow: Optimizing Development ProcessAkbar Hidayat
 
Hands on training on DbFit Part-II
Hands on training on DbFit Part-IIHands on training on DbFit Part-II
Hands on training on DbFit Part-IIBabul Mirdha
 
Test-Driven Development with DbFit and Oracle database, BGOUG Conference, 201...
Test-Driven Development with DbFit and Oracle database, BGOUG Conference, 201...Test-Driven Development with DbFit and Oracle database, BGOUG Conference, 201...
Test-Driven Development with DbFit and Oracle database, BGOUG Conference, 201...Yavor Nikolov
 
見守りサービスMiimaミーマ 資料
見守りサービスMiimaミーマ 資料見守りサービスMiimaミーマ 資料
見守りサービスMiimaミーマ 資料kaisya_account
 
Testing regression
Testing regressionTesting regression
Testing regressionRichie Lee
 
Deliberate Practice (Agile Slovenia 2015)
Deliberate Practice (Agile Slovenia 2015)Deliberate Practice (Agile Slovenia 2015)
Deliberate Practice (Agile Slovenia 2015)Peter Kofler
 
Open Source BI Overview
Open Source BI Overview Open Source BI Overview
Open Source BI Overview Alex Meadows
 
Trivadis TechEvent 2016 A few thoughts on the subject Continuous integration ...
Trivadis TechEvent 2016 A few thoughts on the subject Continuous integration ...Trivadis TechEvent 2016 A few thoughts on the subject Continuous integration ...
Trivadis TechEvent 2016 A few thoughts on the subject Continuous integration ...Trivadis
 
Hands on training on DbFit Part-I
Hands on training on DbFit Part-IHands on training on DbFit Part-I
Hands on training on DbFit Part-IBabul Mirdha
 
Lynn Winterboer : Test automation
Lynn Winterboer : Test automation Lynn Winterboer : Test automation
Lynn Winterboer : Test automation AgileDenver
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven DevelopmentTung Nguyen Thanh
 
Agile Methods and Data Warehousing (2016 update)
Agile Methods and Data Warehousing (2016 update)Agile Methods and Data Warehousing (2016 update)
Agile Methods and Data Warehousing (2016 update)Kent Graziano
 
อัลบั้มรูป
อัลบั้มรูปอัลบั้มรูป
อัลบั้มรูปสพป.นว.1
 
Eindelijk een helder pensioen en 100% online
Eindelijk een helder pensioen en 100% onlineEindelijk een helder pensioen en 100% online
Eindelijk een helder pensioen en 100% onlineBeFrank
 
Inspirational lunch Selor "Open Badges"
Inspirational lunch Selor "Open Badges"Inspirational lunch Selor "Open Badges"
Inspirational lunch Selor "Open Badges"Vincent Van Malderen
 
Petaquilla Minerals Company | Richard Fifer
Petaquilla Minerals Company | Richard FiferPetaquilla Minerals Company | Richard Fifer
Petaquilla Minerals Company | Richard FiferPetaquilla Minerals
 

Andere mochten auch (20)

Test Driven Development - For Girl Geeks Night Sydney
Test Driven Development - For Girl Geeks Night SydneyTest Driven Development - For Girl Geeks Night Sydney
Test Driven Development - For Girl Geeks Night Sydney
 
TDD-based workflow: Optimizing Development Process
TDD-based workflow: Optimizing Development ProcessTDD-based workflow: Optimizing Development Process
TDD-based workflow: Optimizing Development Process
 
Hands on training on DbFit Part-II
Hands on training on DbFit Part-IIHands on training on DbFit Part-II
Hands on training on DbFit Part-II
 
Test-Driven Development with DbFit and Oracle database, BGOUG Conference, 201...
Test-Driven Development with DbFit and Oracle database, BGOUG Conference, 201...Test-Driven Development with DbFit and Oracle database, BGOUG Conference, 201...
Test-Driven Development with DbFit and Oracle database, BGOUG Conference, 201...
 
見守りサービスMiimaミーマ 資料
見守りサービスMiimaミーマ 資料見守りサービスMiimaミーマ 資料
見守りサービスMiimaミーマ 資料
 
Testing regression
Testing regressionTesting regression
Testing regression
 
Deliberate Practice (Agile Slovenia 2015)
Deliberate Practice (Agile Slovenia 2015)Deliberate Practice (Agile Slovenia 2015)
Deliberate Practice (Agile Slovenia 2015)
 
Open Source BI Overview
Open Source BI Overview Open Source BI Overview
Open Source BI Overview
 
Trivadis TechEvent 2016 A few thoughts on the subject Continuous integration ...
Trivadis TechEvent 2016 A few thoughts on the subject Continuous integration ...Trivadis TechEvent 2016 A few thoughts on the subject Continuous integration ...
Trivadis TechEvent 2016 A few thoughts on the subject Continuous integration ...
 
Sigist Presentation 091208 V2.0
Sigist Presentation 091208 V2.0Sigist Presentation 091208 V2.0
Sigist Presentation 091208 V2.0
 
Agile WTF
Agile WTFAgile WTF
Agile WTF
 
Hands on training on DbFit Part-I
Hands on training on DbFit Part-IHands on training on DbFit Part-I
Hands on training on DbFit Part-I
 
Lynn Winterboer : Test automation
Lynn Winterboer : Test automation Lynn Winterboer : Test automation
Lynn Winterboer : Test automation
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Agile Methods and Data Warehousing (2016 update)
Agile Methods and Data Warehousing (2016 update)Agile Methods and Data Warehousing (2016 update)
Agile Methods and Data Warehousing (2016 update)
 
อัลบั้มรูป
อัลบั้มรูปอัลบั้มรูป
อัลบั้มรูป
 
Eindelijk een helder pensioen en 100% online
Eindelijk een helder pensioen en 100% onlineEindelijk een helder pensioen en 100% online
Eindelijk een helder pensioen en 100% online
 
Management
ManagementManagement
Management
 
Inspirational lunch Selor "Open Badges"
Inspirational lunch Selor "Open Badges"Inspirational lunch Selor "Open Badges"
Inspirational lunch Selor "Open Badges"
 
Petaquilla Minerals Company | Richard Fifer
Petaquilla Minerals Company | Richard FiferPetaquilla Minerals Company | Richard Fifer
Petaquilla Minerals Company | Richard Fifer
 

Ähnlich wie TDD - Learn Test Driven Development Fundamentals and Benefits

An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development CodeOps Technologies LLP
 
TDD Flow: The Mantra in Action
TDD Flow: The Mantra in ActionTDD Flow: The Mantra in Action
TDD Flow: The Mantra in ActionDionatan default
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Gianluca Padovani
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Developmentguestc8093a6
 
SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 20_ Test-Driven Development (TDD)SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 20_ Test-Driven Development (TDD)Amr E. Mohamed
 
Test Presentation
Test PresentationTest Presentation
Test Presentationsetitesuk
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Qualityguest268ee8
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In ActionJon Kruger
 
Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Babul Mirdha
 
How do you tame a big ball of mud? One test at a time.
How do you tame a big ball of mud? One test at a time.How do you tame a big ball of mud? One test at a time.
How do you tame a big ball of mud? One test at a time.Matt Eland
 
Unit testing for 40 square software
Unit testing for 40 square softwareUnit testing for 40 square software
Unit testing for 40 square softwareRuben Tan
 
Introduction to testing in Rails
Introduction to testing in RailsIntroduction to testing in Rails
Introduction to testing in Railsbenlcollins
 
Test driven development
Test driven developmentTest driven development
Test driven developmentJohn Walsh
 
Nguyenvandungb seminar
Nguyenvandungb seminarNguyenvandungb seminar
Nguyenvandungb seminardunglinh111
 

Ähnlich wie TDD - Learn Test Driven Development Fundamentals and Benefits (20)

An Introduction to Test Driven Development
An Introduction to Test Driven Development An Introduction to Test Driven Development
An Introduction to Test Driven Development
 
TDD Flow: The Mantra in Action
TDD Flow: The Mantra in ActionTDD Flow: The Mantra in Action
TDD Flow: The Mantra in Action
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
 
Why unit testingl
Why unit testinglWhy unit testingl
Why unit testingl
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 20_ Test-Driven Development (TDD)SE2018_Lec 20_ Test-Driven Development (TDD)
SE2018_Lec 20_ Test-Driven Development (TDD)
 
Test Presentation
Test PresentationTest Presentation
Test Presentation
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Quality
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
TDD Workshop UTN 2012
TDD Workshop UTN 2012TDD Workshop UTN 2012
TDD Workshop UTN 2012
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In Action
 
Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)
 
TDD and Getting Paid
TDD and Getting PaidTDD and Getting Paid
TDD and Getting Paid
 
How do you tame a big ball of mud? One test at a time.
How do you tame a big ball of mud? One test at a time.How do you tame a big ball of mud? One test at a time.
How do you tame a big ball of mud? One test at a time.
 
Unit testing for 40 square software
Unit testing for 40 square softwareUnit testing for 40 square software
Unit testing for 40 square software
 
Introduction to testing in Rails
Introduction to testing in RailsIntroduction to testing in Rails
Introduction to testing in Rails
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Nguyenvandungb seminar
Nguyenvandungb seminarNguyenvandungb seminar
Nguyenvandungb seminar
 

Mehr von Quang Nguyễn Bá

Lesson 09 Resources and Settings in WPF
Lesson 09 Resources and Settings in WPFLesson 09 Resources and Settings in WPF
Lesson 09 Resources and Settings in WPFQuang Nguyễn Bá
 
Lesson 08 Documents and Printings in WPF
Lesson 08 Documents and Printings in WPFLesson 08 Documents and Printings in WPF
Lesson 08 Documents and Printings in WPFQuang Nguyễn Bá
 
Lesson 07 Actions and Commands in WPF
Lesson 07 Actions and Commands in WPFLesson 07 Actions and Commands in WPF
Lesson 07 Actions and Commands in WPFQuang Nguyễn Bá
 
Lesson 06 Styles and Templates in WPF
Lesson 06 Styles and Templates in WPFLesson 06 Styles and Templates in WPF
Lesson 06 Styles and Templates in WPFQuang Nguyễn Bá
 
Lesson 02 Introduction to XAML
Lesson 02 Introduction to XAMLLesson 02 Introduction to XAML
Lesson 02 Introduction to XAMLQuang Nguyễn Bá
 
Scrum sử dụng Team Foundation Server 2012
Scrum sử dụng Team Foundation Server 2012Scrum sử dụng Team Foundation Server 2012
Scrum sử dụng Team Foundation Server 2012Quang Nguyễn Bá
 
Introduction to Microsoft SQL Server 2008 R2 Integration Services
Introduction to Microsoft SQL Server 2008 R2 Integration ServicesIntroduction to Microsoft SQL Server 2008 R2 Integration Services
Introduction to Microsoft SQL Server 2008 R2 Integration ServicesQuang Nguyễn Bá
 
Introduction to Business Intelligence in Microsoft SQL Server 2008 R2
Introduction to Business Intelligence in Microsoft SQL Server 2008 R2Introduction to Business Intelligence in Microsoft SQL Server 2008 R2
Introduction to Business Intelligence in Microsoft SQL Server 2008 R2Quang Nguyễn Bá
 
Introduction to Microsoft SQL Server 2008 R2 Analysis Service
Introduction to Microsoft SQL Server 2008 R2 Analysis ServiceIntroduction to Microsoft SQL Server 2008 R2 Analysis Service
Introduction to Microsoft SQL Server 2008 R2 Analysis ServiceQuang Nguyễn Bá
 
SharePoint 2010 Business Intelligence
SharePoint 2010 Business IntelligenceSharePoint 2010 Business Intelligence
SharePoint 2010 Business IntelligenceQuang Nguyễn Bá
 
Programming SharePoint 2010 with Visual Studio 2010
Programming SharePoint 2010 with Visual Studio 2010Programming SharePoint 2010 with Visual Studio 2010
Programming SharePoint 2010 with Visual Studio 2010Quang Nguyễn Bá
 

Mehr von Quang Nguyễn Bá (20)

Lesson 09 Resources and Settings in WPF
Lesson 09 Resources and Settings in WPFLesson 09 Resources and Settings in WPF
Lesson 09 Resources and Settings in WPF
 
Lesson 08 Documents and Printings in WPF
Lesson 08 Documents and Printings in WPFLesson 08 Documents and Printings in WPF
Lesson 08 Documents and Printings in WPF
 
Lesson 07 Actions and Commands in WPF
Lesson 07 Actions and Commands in WPFLesson 07 Actions and Commands in WPF
Lesson 07 Actions and Commands in WPF
 
Lesson 06 Styles and Templates in WPF
Lesson 06 Styles and Templates in WPFLesson 06 Styles and Templates in WPF
Lesson 06 Styles and Templates in WPF
 
Lesson 05 Data Binding in WPF
Lesson 05 Data Binding in WPFLesson 05 Data Binding in WPF
Lesson 05 Data Binding in WPF
 
Lesson 04 WPF Controls
Lesson 04 WPF ControlsLesson 04 WPF Controls
Lesson 04 WPF Controls
 
Lesson 03 Layouts in WPF
Lesson 03 Layouts in WPFLesson 03 Layouts in WPF
Lesson 03 Layouts in WPF
 
Lesson 02 Introduction to XAML
Lesson 02 Introduction to XAMLLesson 02 Introduction to XAML
Lesson 02 Introduction to XAML
 
Lesson 01 Introduction to WPF
Lesson 01 Introduction to WPFLesson 01 Introduction to WPF
Lesson 01 Introduction to WPF
 
Business intelligence
Business intelligenceBusiness intelligence
Business intelligence
 
Scrum sử dụng Team Foundation Server 2012
Scrum sử dụng Team Foundation Server 2012Scrum sử dụng Team Foundation Server 2012
Scrum sử dụng Team Foundation Server 2012
 
Introduction to Microsoft SQL Server 2008 R2 Integration Services
Introduction to Microsoft SQL Server 2008 R2 Integration ServicesIntroduction to Microsoft SQL Server 2008 R2 Integration Services
Introduction to Microsoft SQL Server 2008 R2 Integration Services
 
Introduction to Business Intelligence in Microsoft SQL Server 2008 R2
Introduction to Business Intelligence in Microsoft SQL Server 2008 R2Introduction to Business Intelligence in Microsoft SQL Server 2008 R2
Introduction to Business Intelligence in Microsoft SQL Server 2008 R2
 
Introduction to Microsoft SQL Server 2008 R2 Analysis Service
Introduction to Microsoft SQL Server 2008 R2 Analysis ServiceIntroduction to Microsoft SQL Server 2008 R2 Analysis Service
Introduction to Microsoft SQL Server 2008 R2 Analysis Service
 
Office 2010 Programming
Office 2010 ProgrammingOffice 2010 Programming
Office 2010 Programming
 
Giới thiệu WCF
Giới thiệu WCFGiới thiệu WCF
Giới thiệu WCF
 
MOSS 2007 Overview
MOSS 2007 OverviewMOSS 2007 Overview
MOSS 2007 Overview
 
SharePoint Programming Basic
SharePoint Programming BasicSharePoint Programming Basic
SharePoint Programming Basic
 
SharePoint 2010 Business Intelligence
SharePoint 2010 Business IntelligenceSharePoint 2010 Business Intelligence
SharePoint 2010 Business Intelligence
 
Programming SharePoint 2010 with Visual Studio 2010
Programming SharePoint 2010 with Visual Studio 2010Programming SharePoint 2010 with Visual Studio 2010
Programming SharePoint 2010 with Visual Studio 2010
 

Kürzlich hochgeladen

Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Kürzlich hochgeladen (20)

Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

TDD - Learn Test Driven Development Fundamentals and Benefits

  • 1. TDD – Test Driven Development Quang Nguyen Ba Software www.hyperlogy.com
  • 2. Contents  What is Test Driven Development (TDD)  Red/Green/Refactor Concepts  TDD Programming Tasks  TDD Benefits  .NET Examples  TDD Tools www.hyperlogy.com
  • 3. Test Driven Development  Developed by Kend Beck  Related to Test First programming concepts of XP  Goals – Clean code: no less, no more, no duplicate. – Automated Test – Agile www.hyperlogy.com
  • 4. 2010 How Agile Are You? survey, www.hyperlogy.com
  • 5. Test Driven Development  TDD Rules – Write new code only if you first have a failing automated test. – Eliminate duplication.  Test Types – Programmer Tests: Technical facing or Unit test • Tests are created by developer – Customer Tests: Business facing, acceptance test • Test are created by customer www.hyperlogy.com
  • 6. Red/Green/Refactor  Red – write a little test that doesn’t work, perhaps doesn’t even compile at first  Green – make the test work quickly, committing whatever sins necessary in the process  Refactor – eliminate all the duplication created in just getting the test to work www.hyperlogy.com
  • 7. TDD Programming Tasks 1. Write the test code. 2. Compile the test code. (It should fail because you haven’t implemented anything yet.) 3. Implement just enough to compile. 4. Run the test and see it fail. 5. Implement just enough to make the test pass. 6. Run the test and see it pass. 7. Refactor for clarity and to eliminate duplication. 8. Repeat from the top. www.hyperlogy.com
  • 8. TDD Benefits  The suite of unit tests provides constant feedback that each component is still working.  The unit tests act as documentation that cannot go out-of-date  When the test passes and the production code is refactored to remove duplication, it is clear that the code is finished, and the developer can move on to a new test. www.hyperlogy.com
  • 9. TDD Benefits  Test-driven development forces critical analysis and design  The software tends to be better designed, that is, loosely coupled and easily maintainable  Reduced debugging time!  Reduced manual testing time  Continuous Integration www.hyperlogy.com
  • 10. TDD Example  Unbounded Stack – Push: inserts an element onto the top – Pop: removes the topmost element and returns it – Top: operation returns the topmost element but does not remove it from the Stack – IsEmpty: returns true when there are no elements on the Stack www.hyperlogy.com
  • 11. Unbounded Stack Test Cases 1. Create a Stack and verify that IsEmpty is true. 2. Push a single object on the Stack and verify that IsEmpty is false. 3. Push a single object, Pop the object, and verify that IsEmpty is true. 4. Push a single object, remembering what it is; Pop the object, and verify that the two objects are equal. 5. Push three objects, remembering what they are; Pop each one, and verify that they are removed in the correct order. 6. Pop a Stack that has no elements. 7. Push a single object and then call Top. Verify that IsEmpty is false. www.hyperlogy.com
  • 12. Unbounded Stack Test List 8. Push a single object, remembering what it is; and then call Top. Verify that the object that is returned is the same as the one that was pushed. 9. Push multiple objects, remembering what they are; call Top, and verify that the last item pushed is equal to the one returned by Top. 10. Push one object and call Top repeatedly, comparing what is returned to what was pushed. 11. Call Top on a Stack with no elements. 12. Push null onto the Stack and verify that IsEmpty is false. 13. Push null onto the Stack, Pop the Stack, and verify that the value returned is null. 14. Push null onto the Stack, call Top, and verify that the value returned is null. www.hyperlogy.com
  • 13. TDD Tools  cpputest  NDbUnit  csUnit (.Net)  NUnit  CUnit  OUnit  DUnit (Delphi)  PHPUnit  DBFit  PyUnit (Python)  DBUnit  SimpleTest  DocTest (Python)  TestNG  Googletest  TestOoB (Python)  HTMLUnit  Test::Unit (Ruby)  HTTPUnit  VBUnit  JMock  XTUnit  JUnit  xUnit.net  Moq www.hyperlogy.com
  • 14. References  http://en.wikipedia.org/wiki/Test- driven_development  http://www.agiledata.org/essays/tdd.html  http://msdn.microsoft.com/en- us/library/aa730844(v=vs.80).aspx  http://en.wikipedia.org/wiki/Kent_Beck  Test-Driven Development: By Example (Addison- Wesley Professional, 2003),  Test-Driven Development in Microsoft .NET by James W. Newkirk and Alexei A. Vorontsov ISBN:0735619484 Microsoft Press © 2004 www.hyperlogy.com
  • 15. Trân trọng cảm ơn! www.hyperlogy.com www.hyperlogy.com

Hinweis der Redaktion

  1. The first rule is straightforward: don’t write code without having a failing automated test because the tests embody the requirements that the code must satisfy, as stated in the Introduction. If there is no requirement (that is, test), there is no need to implement anything. This rule prevents us from implementing functionality that is not tested and not needed in the solution.The second rule states that no code should be duplicated in the program. Code duplication is the epitome of bad software design; it leads to inconsistency problems and a reduced level of confidence in the program over time as people forget where the duplications are. If there is code duplication, it is the programmer’s job to remove it when it is seen. (In Extreme Programming [XP], this rule is called “Once and Only Once!”)
  2. Test ListIn Kent Beck’s book, Test-Driven Development: By Example (Addison-Wesley, 2003), he describes a test list. When starting a new task or feature, you need to brainstorm a list of tests. As you think about these tests, write them down. In addition to describing the requirements unambiguously, this test list also indicates the scope of the activity and is the most complete definition of the completion criteria. How long should you spend doing this? For most tasks that end up taking about 4 hours, we spend about 15–20 minutes doing this activity. If the scope of the list is too large, the list can be the basis for further estimation.
  3. Test-driven development forces critical analysis and design because the developer cannot create the production code without truly understanding what the desired result should be and how to test it.The software tends to be better designed, that is, loosely coupled and easily maintainable, because the developer is free to make design decisions and refactor at any time with confidence that the software is still working. This confidence is gained by running the tests. The need for a design pattern may emerge, and the code can be changed at that time. The test suite acts as a regression safety net on bugs: If a bug is found, the developer should create a test to reveal the bug and then modify the production code so that the bug goes away and all other tests still pass. On each successive test run, all previous bug fixes are verified.
  4. Choosing the First TestThere are differing opinions about which test to choose first. One says that you should choose the simplest test that gets you started and solves a small piece of the problem. Another says that you should choose a test that describes the essence of what you are trying to accomplish. For example, looking at the test list in the previous section, the simplest test is the first one: Create an empty Stack and verify that IsEmpty is true. This operation looks as if it would be easy to implement, but it does not provide a great deal of useful feedback when developing a Stack because the IsEmpty function is a supporting function.