SlideShare a Scribd company logo
1 of 23
TEST DRIVEN
DEVELOPMENT
+
UNIT TESTING
Using Visual Studio 2010/2012 and Eclipse
By Andrzej Piotrowski
Agenda





Importance of Unit Testing
Test Driven Development
TDD Techniques
Unit test in .net (VS2010)
1.
2.
3.



MSTest
nUnit
Mock

Big Projects (VS2010 and Eclipse)
Unit Testing



A unit is the smallest testable part of software.
In object-oriented programming, the smallest unit
is a method, which may belong to a base/super
class, abstract class or derived/child class.
Acceptance Testing

System Testing

Integration Testing

Unit Testing
Unit testing myths











“Testers test, developers develop”
“There’s no time to write tests.”
“We’ll write the unit tests later.”
“The code will change, so the tests will fail
in the (near) future.”
“The test we wrote some time ago
(probably) don’t work anymore.”
“Not easy to maitain for big projects”
“Time waste for existing projects”
Test Driven Development (TDD)
 A software development technique that uses short

development iterations based on pre-written test cases that
define desired improvements or new functions.
 Each iteration produces code necessary to pass that

iteration's tests. Finally, the programmer or team refactors
the code to accommodate changes.
 A key TDD concept is that preparing tests before coding

facilitates rapid feedback changes.
Metric of usage TTD in Projects


Level 0 – huh?




Level 1 – we write unit tests.




We write a unit test, then some code, then some more code.

Level 3 – we do Test-Driven Development




We wrote some tests for critical parts.

Level 2 – we write (most of) our unit tests first.




What’s a unit test?

We write a unit test, then we write some code to make it pass.
Then we refactor, and do it all over again.

Level 4 – we do Acceptance Test-Driven development


We automate our acceptance criteria into acceptance tests
first, and then use failing AT’s until our AT’s pass.
TTD = RGR + CT

Refactor

Write a little
test

Cycle loop
< 10min
Get the test
pass

Red-Green-Refactor

Stub the
code.
Watch if
fails

Continuous (integration) Testing

Test Driven Development
Test Driven Development Rules


Adding New Functionality “Test First” ( Red) (Green)
Write an “empty” implementation
 Write a failing test: this is your requirements
 Make the test pass
 Requirements are completed




Fixing a Bug (Red)
Write a failing test that demonstrates the bug
 Fix the bug
 The test will make sure the bug does not happen again




Changing Implementation (Refactor)
Make your changes
 Make sure all tests pass
 All requirements/change request are satisfied

TTD – words of wisdom


Arrange
Setup. Set up all the data and conditions that the test
needs to execute. Create anything that is needed for
the test to operate independently of its environment.
 Mock out any dependent systems
 Control all variables not under test




Act




Execution – execute the mainline code

Assert


Validate that the code operated as intended
Visual Studio 2010
TDD Techniques


Common Unit Test Patterns
– provide input and check result for
acceptance or failure.
 Code-path – provide values that force the code
through a specific path.
 Parameter-range – pass a set of parameters that
cause success, and a set that cause failure.
 Data-driven – pass in sets of data and their
expected outcomes
 Dependency Injection
 Simple-test
More TDD Techniques


Mock Objects
 Mocks

are used to remove dependencies on
external systems or components.
 Example: Mock Database
 The mock will just be programmed to return
certain packages of data according to which test
is being run.
Unit test in .net











NUnit
MSTest
TestDriven
Moq
RhinoMocks
Typemock
Microsoft Fakes
…
nUnit
Important Attributes

1. [SetUp]
SetUp is generally used for any initialization purpose.
Any code that must be initialized or set prior to executing a test,
are put in functions marked with this attribute.
As a consequence, it avoids the problem of code repetition in each test.
2. [Ignore]
3. [ExpectedException]
4. [TearDown]
MSTest
the [TestMethod()] attribute. Without the
TestClass attribute, the test methods are
ignored
nUnit vs MSTest
Moq
Architecture in Visual Studio 2012
Developer Focused Unit Test Experience
New features - better testing



Derived from Microsoft Research “Moles” project
Fakes come in two flavors
– concrete implementations of interfaces or
abstract classes that you can pass in to your systemunder-test to isolate it from real implementations
 Shims – generated classes that enable you to intercept
and replace calls to existing classes, even those from
the .NET BCL!
 Stubs
References


http://msdn.microsoft.com/enus/library/dd264975.aspx



http://msdn.microsoft.com/en-us/library/ms182409



http://blog.stevensanderson.com/2009/08/24/writi
ng-great-unit-tests-best-and-worst-practises/



http://en.wikipedia.org/wiki/Unit_testing
References


http://weblogs.asp.net/adilakhter/archive/2008/05/04/
more-on-unit-testing-testcontext.aspx



http://www.c-sharpcorner.com/uploadfile/dommym/atest-driven-development-tutorial-in-C-Sharp-4-0/



http://msdn.microsoft.com/enus/vstudio/ff718185.aspx



http://www.simple-talk.com/sql/t-sqlprogramming/close-these-loopholes---reproducedatabase-errors/
Eclipse


http://www.happyprog.com/tdgotchi/

More Related Content

What's hot

Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And MockingJoe Wilson
 
Unit Testing Fundamentals
Unit Testing FundamentalsUnit Testing Fundamentals
Unit Testing FundamentalsRichard Paul
 
Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testingikhwanhayat
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Jacinto Limjap
 
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove
 
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
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitweili_at_slideshare
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBaskar K
 
Xp Day 080506 Unit Tests And Mocks
Xp Day 080506 Unit Tests And MocksXp Day 080506 Unit Tests And Mocks
Xp Day 080506 Unit Tests And Mocksguillaumecarre
 
Unit testing
Unit testing Unit testing
Unit testing dubbu
 
Unit testing with NUnit
Unit testing with NUnitUnit testing with NUnit
Unit testing with NUnitkleinron
 
Embrace Unit Testing
Embrace Unit TestingEmbrace Unit Testing
Embrace Unit Testingalessiopace
 
Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.Deepak Singhvi
 

What's hot (20)

Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And Mocking
 
N Unit Presentation
N Unit PresentationN Unit Presentation
N Unit Presentation
 
Unit Testing Fundamentals
Unit Testing FundamentalsUnit Testing Fundamentals
Unit Testing Fundamentals
 
Understanding Unit Testing
Understanding Unit TestingUnderstanding Unit Testing
Understanding Unit Testing
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible MistakesRoy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
 
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
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Unit testing
Unit testingUnit testing
Unit testing
 
An Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnitAn Introduction to Unit Test Using NUnit
An Introduction to Unit Test Using NUnit
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
 
Xp Day 080506 Unit Tests And Mocks
Xp Day 080506 Unit Tests And MocksXp Day 080506 Unit Tests And Mocks
Xp Day 080506 Unit Tests And Mocks
 
Testing In Java
Testing In JavaTesting In Java
Testing In Java
 
Unit testing
Unit testing Unit testing
Unit testing
 
Unit testing with NUnit
Unit testing with NUnitUnit testing with NUnit
Unit testing with NUnit
 
Embrace Unit Testing
Embrace Unit TestingEmbrace Unit Testing
Embrace Unit Testing
 
Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.Testing and Mocking Object - The Art of Mocking.
Testing and Mocking Object - The Art of Mocking.
 
Unit test
Unit testUnit test
Unit test
 

Similar to Test driven development in .Net - 2010 + Eclipse

Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In ActionJon Kruger
 
An introduction to unit testing
An introduction to unit testingAn introduction to unit testing
An introduction to unit testingAdam Stephensen
 
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
 
Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Gianluca Padovani
 
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex ScenariosUnit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex ScenariosFlutter Agency
 
Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Babul Mirdha
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Ukraine
 
Test driven development
Test driven developmentTest driven development
Test driven developmentlukaszkujawa
 
Google test training
Google test trainingGoogle test training
Google test trainingThierry Gayet
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkPeter Kofler
 

Similar to Test driven development in .Net - 2010 + Eclipse (20)

Unit testing
Unit testingUnit testing
Unit testing
 
TDD Workshop UTN 2012
TDD Workshop UTN 2012TDD Workshop UTN 2012
TDD Workshop UTN 2012
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In Action
 
TDD Best Practices
TDD Best PracticesTDD Best Practices
TDD Best Practices
 
An introduction to unit testing
An introduction to unit testingAn introduction to unit testing
An introduction to unit testing
 
TDD - Agile
TDD - Agile TDD - Agile
TDD - Agile
 
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
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)Tdd is not about testing (C++ version)
Tdd is not about testing (C++ version)
 
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex ScenariosUnit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
 
Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)Test Driven iOS Development (TDD)
Test Driven iOS Development (TDD)
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Google test training
Google test trainingGoogle test training
Google test training
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
 
Why unit testingl
Why unit testinglWhy unit testingl
Why unit testingl
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
 

More from UTC Fire & Security

Jaming the IoT device- nie dziala mi alarm IoT
Jaming the IoT device- nie dziala mi alarm IoTJaming the IoT device- nie dziala mi alarm IoT
Jaming the IoT device- nie dziala mi alarm IoTUTC Fire & Security
 
The past and present iot technologies andrzej piotrowski
The past and present iot technologies andrzej piotrowskiThe past and present iot technologies andrzej piotrowski
The past and present iot technologies andrzej piotrowskiUTC Fire & Security
 
Big Data - Targi Kreatywne - szczecin
Big Data - Targi Kreatywne - szczecinBig Data - Targi Kreatywne - szczecin
Big Data - Targi Kreatywne - szczecinUTC Fire & Security
 
Informatyk w Pracy - Informatyka na Rynku Pracy
Informatyk w Pracy - Informatyka na Rynku PracyInformatyk w Pracy - Informatyka na Rynku Pracy
Informatyk w Pracy - Informatyka na Rynku PracyUTC Fire & Security
 
"Startups : Shortcut Everything"
"Startups : Shortcut Everything" "Startups : Shortcut Everything"
"Startups : Shortcut Everything" UTC Fire & Security
 
TEDxWSB - 2012 - Sky is the limit
TEDxWSB - 2012 - Sky is the limitTEDxWSB - 2012 - Sky is the limit
TEDxWSB - 2012 - Sky is the limitUTC Fire & Security
 
So, what will the future UX of TV look like?
So, what will the future UX of TV look like?So, what will the future UX of TV look like?
So, what will the future UX of TV look like?UTC Fire & Security
 
Preznetacja ochrona innowacji - cz ii
Preznetacja   ochrona innowacji - cz ii Preznetacja   ochrona innowacji - cz ii
Preznetacja ochrona innowacji - cz ii UTC Fire & Security
 
Preznetacja ochrona innowacji - cz i
Preznetacja   ochrona innowacji - cz i Preznetacja   ochrona innowacji - cz i
Preznetacja ochrona innowacji - cz i UTC Fire & Security
 
Przyszłość Rolnictwa w Polsce
Przyszłość Rolnictwa w PolscePrzyszłość Rolnictwa w Polsce
Przyszłość Rolnictwa w PolsceUTC Fire & Security
 
Skalowalność systemów informatycznych dedykowanych rolnictwu z perspektywy st...
Skalowalność systemów informatycznych dedykowanych rolnictwu z perspektywy st...Skalowalność systemów informatycznych dedykowanych rolnictwu z perspektywy st...
Skalowalność systemów informatycznych dedykowanych rolnictwu z perspektywy st...UTC Fire & Security
 
Workshop - Szkolenie Xamarin Android
Workshop - Szkolenie Xamarin AndroidWorkshop - Szkolenie Xamarin Android
Workshop - Szkolenie Xamarin AndroidUTC Fire & Security
 
Speaker Idol - Wpf wtf - Mts 2008
Speaker Idol - Wpf  wtf - Mts 2008Speaker Idol - Wpf  wtf - Mts 2008
Speaker Idol - Wpf wtf - Mts 2008UTC Fire & Security
 
ImagineCup 2008 - LookAround - II Round Finalist
ImagineCup 2008 - LookAround - II Round FinalistImagineCup 2008 - LookAround - II Round Finalist
ImagineCup 2008 - LookAround - II Round FinalistUTC Fire & Security
 
Speaker Idol - ccwwa2009 - Winner Solution :)
Speaker Idol - ccwwa2009 - Winner Solution :)Speaker Idol - ccwwa2009 - Winner Solution :)
Speaker Idol - ccwwa2009 - Winner Solution :)UTC Fire & Security
 
Manual - BadBug Studio - Xbox Game
Manual - BadBug Studio - Xbox GameManual - BadBug Studio - Xbox Game
Manual - BadBug Studio - Xbox GameUTC Fire & Security
 
Game design document - BadBug Studio - Xbox Game
Game design document - BadBug Studio - Xbox GameGame design document - BadBug Studio - Xbox Game
Game design document - BadBug Studio - Xbox GameUTC Fire & Security
 
Technical document - BadBug Studio - Xbox Game
Technical document - BadBug Studio - Xbox GameTechnical document - BadBug Studio - Xbox Game
Technical document - BadBug Studio - Xbox GameUTC Fire & Security
 
Imagine Cup 2010 - Project Rolnictwo - Wygrana na Warszawskie Dni Informatyki :)
Imagine Cup 2010 - Project Rolnictwo - Wygrana na Warszawskie Dni Informatyki :)Imagine Cup 2010 - Project Rolnictwo - Wygrana na Warszawskie Dni Informatyki :)
Imagine Cup 2010 - Project Rolnictwo - Wygrana na Warszawskie Dni Informatyki :)UTC Fire & Security
 

More from UTC Fire & Security (20)

Jaming the IoT device- nie dziala mi alarm IoT
Jaming the IoT device- nie dziala mi alarm IoTJaming the IoT device- nie dziala mi alarm IoT
Jaming the IoT device- nie dziala mi alarm IoT
 
The past and present iot technologies andrzej piotrowski
The past and present iot technologies andrzej piotrowskiThe past and present iot technologies andrzej piotrowski
The past and present iot technologies andrzej piotrowski
 
Big Data - Targi Kreatywne - szczecin
Big Data - Targi Kreatywne - szczecinBig Data - Targi Kreatywne - szczecin
Big Data - Targi Kreatywne - szczecin
 
Informatyk w Pracy - Informatyka na Rynku Pracy
Informatyk w Pracy - Informatyka na Rynku PracyInformatyk w Pracy - Informatyka na Rynku Pracy
Informatyk w Pracy - Informatyka na Rynku Pracy
 
"Startups : Shortcut Everything"
"Startups : Shortcut Everything" "Startups : Shortcut Everything"
"Startups : Shortcut Everything"
 
TEDxWSB - 2012 - Sky is the limit
TEDxWSB - 2012 - Sky is the limitTEDxWSB - 2012 - Sky is the limit
TEDxWSB - 2012 - Sky is the limit
 
So, what will the future UX of TV look like?
So, what will the future UX of TV look like?So, what will the future UX of TV look like?
So, what will the future UX of TV look like?
 
How to achieve the ux goals
How to achieve the ux goalsHow to achieve the ux goals
How to achieve the ux goals
 
Preznetacja ochrona innowacji - cz ii
Preznetacja   ochrona innowacji - cz ii Preznetacja   ochrona innowacji - cz ii
Preznetacja ochrona innowacji - cz ii
 
Preznetacja ochrona innowacji - cz i
Preznetacja   ochrona innowacji - cz i Preznetacja   ochrona innowacji - cz i
Preznetacja ochrona innowacji - cz i
 
Przyszłość Rolnictwa w Polsce
Przyszłość Rolnictwa w PolscePrzyszłość Rolnictwa w Polsce
Przyszłość Rolnictwa w Polsce
 
Skalowalność systemów informatycznych dedykowanych rolnictwu z perspektywy st...
Skalowalność systemów informatycznych dedykowanych rolnictwu z perspektywy st...Skalowalność systemów informatycznych dedykowanych rolnictwu z perspektywy st...
Skalowalność systemów informatycznych dedykowanych rolnictwu z perspektywy st...
 
Workshop - Szkolenie Xamarin Android
Workshop - Szkolenie Xamarin AndroidWorkshop - Szkolenie Xamarin Android
Workshop - Szkolenie Xamarin Android
 
Speaker Idol - Wpf wtf - Mts 2008
Speaker Idol - Wpf  wtf - Mts 2008Speaker Idol - Wpf  wtf - Mts 2008
Speaker Idol - Wpf wtf - Mts 2008
 
ImagineCup 2008 - LookAround - II Round Finalist
ImagineCup 2008 - LookAround - II Round FinalistImagineCup 2008 - LookAround - II Round Finalist
ImagineCup 2008 - LookAround - II Round Finalist
 
Speaker Idol - ccwwa2009 - Winner Solution :)
Speaker Idol - ccwwa2009 - Winner Solution :)Speaker Idol - ccwwa2009 - Winner Solution :)
Speaker Idol - ccwwa2009 - Winner Solution :)
 
Manual - BadBug Studio - Xbox Game
Manual - BadBug Studio - Xbox GameManual - BadBug Studio - Xbox Game
Manual - BadBug Studio - Xbox Game
 
Game design document - BadBug Studio - Xbox Game
Game design document - BadBug Studio - Xbox GameGame design document - BadBug Studio - Xbox Game
Game design document - BadBug Studio - Xbox Game
 
Technical document - BadBug Studio - Xbox Game
Technical document - BadBug Studio - Xbox GameTechnical document - BadBug Studio - Xbox Game
Technical document - BadBug Studio - Xbox Game
 
Imagine Cup 2010 - Project Rolnictwo - Wygrana na Warszawskie Dni Informatyki :)
Imagine Cup 2010 - Project Rolnictwo - Wygrana na Warszawskie Dni Informatyki :)Imagine Cup 2010 - Project Rolnictwo - Wygrana na Warszawskie Dni Informatyki :)
Imagine Cup 2010 - Project Rolnictwo - Wygrana na Warszawskie Dni Informatyki :)
 

Recently uploaded

MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 

Recently uploaded (20)

MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 

Test driven development in .Net - 2010 + Eclipse

Editor's Notes

  1. This is the “New Project” dialog that is accessed from the IDE “File” menu. Here is where you add the Test Project to your application’s solution. To add the Test Project to your solution, you must select the “Test Project” template from the template list in the center of the dialog. Then you must give the project a name. The name of the application being tested with “Test” appended to it is a good naming convention to follow for your unit test projects. Choose a location at the same directory level or below your application directory. Be sure you choose “Add to Solution” on the solution line from the dropdown list.
  2. This is an example unit test project for an executable that is part of an ETL process. It contains test class files for each of the test classes in the application. It contains a folder, TestFiles, which contains data files for each of the test classes. Finally, it contains a utility class with common methods used by all of the unit test classes.You may or may not choose to follow this structure. It is not required or necessarily suited to your environment.
  3. Add the Microsoft.VisualStudio.TestTools.UnitTesting namespace with a using directive at the top of your unit test files.
  4. A unit test class must be marked with the [TestClass] attribute in order for tests within the class to be executed by the testing framework.
  5. Each unit test class must have a TestContext property that can be accessed by the test framework.
  6. Example of UnitTest class TestContext declaration section.
  7. Initialize methods are typically used to setup the test environment to a known state. ClassInitialize does this once before any of the test methods are run in the UnitTest class.
  8. ClassInitialize method. This example shows file directories used by tests being cleared, test files being copied, a test database being created and a test table being created. These are the types of tasks done in initialize methods. They bring the test environment into a known state so that the test results can be relied upon to be accurate.
  9. Cleanup methods are the counterparts to initialize methods. They handle any of the tasks that would need to be performed subsequent to test methods executing. The ClassCleanUp method executes after all of the test methods in the unit test class have run.
  10. ClassCleanUp method. This example shows test database being dropped after all tests in class have been executed.
  11. TestInitialize is run prior to each test method in the unit test class executing. This differs from the ClassInitialize in that it performs tasks that must be done before each of the tests is run rather than once before all of the tests are run.
  12. TestCleanUp is the counterpart to TestInitialize. This method will execute after each of the test methods in a unit test class.
  13. Example of tests that test public properties. Test names are the Property Name with the word Test appended to them.
  14. Examples of tests that test a specific requirement. The name of each test clearly indicates what the requirement is. Each method name is appended with the word Test.
  15. For more information about theMicrosoft.VisualStudio.TestTools.UnitTesting namespace see MSDN documentation found at:http://msdn.microsoft.com/en-us/library/ms244252http://msdn.microsoft.com/en-us/library/ms244252
  16. The add new test dialog. Choose the Unit Test item to add a standard unit test to your project.
  17. This is what a default unit test class skeleton looks like before you modify it with your code. It contains a class definition with the [TestClass] attribute. It also contains a definition for the TestContext class variable, commented initialize/cleanup methods and a sample test method skeleton called TestMethod1.
  18. The “Add New Test” dialog with Unit Test Wizard selected.
  19. Unit Test Wizard page that allows you to select what tests you wish to have generated.
  20. Adding tests when you create a new property or method in your code is easy. Place the cursor within the body of the property/method. Right-click the mouse to display the context menu. Choose the “Create Unit Tests” option. Accept the defaults Visual Studio provides. Click OK. The new skeleton method will be added to the class that corresponds to your application class.
  21. Test List Editor with tests grouped by Class Name for easiest viewing/selecting of tests to run. Green arrow on upper left of window is for running or debugging tests. Choose by clicking the little black down arrow to select whether you run or debug the tests that are checked in the test pane of the editor.You may create custom groups of tests to run. By doing this, you can avoid having to check/uncheck specific tests in left pane before executing them.
  22. Test Results window shows summary of test run. Test runs can be selected from dropdown list at top left of screen. Double-clicking on individual row will show detail window for individual test result.
  23. This window shows details of an individual test result. It is most useful when a test fails as it gives detailed error information.
  24. Test Results window will load most recent run by default.Select run name from dropdown at top of test results window to view other than most recent test run.
  25. To learn more about the Visual Studio 2010 testing framework, general unit testing best practices, unit testing concepts and mastering features of the unit testing framework, see the links provided in the following three reference pages.