SlideShare a Scribd company logo
unit testing, ui testing, & test-
driven development in visual
studio 2012




Jon Limjap
C# MVP
Agenda
• Overview of Unit Testing, UI Testing and
  Test Driven Development
• Unit testing UI and code in Visual Studio
  2012
what’s up with all these tests?
         overview of unit testing, ui
         testing, and test driven
         development
Let’s talk about unit testing
• What is Unit Testing?
• What is UI Testing?
• What is Test Driven Development?
What is a unit test?
• Code that test a single unit of functionality
  (obviously!)
• A single unit is any block of code that has
  ONE and only ONE responsibility:
  – Method
  – Function
  – Class
What is User Interface Testing?
   Using unit tests to validate user
    interaction
   Automates user actions: clicking and
    typing
   Automated UI tests allow your machine to
    do repetitive tasks across an application’s
    interface for you ;)
What is Test Driven
Development?
   Using unit tests to design software
   Allows change in code without fear of
    changing functionality
   Produces loosely coupled objects and
    methods with single responsibilities
   Unit tests become a tool to guide code
    design
Red Green Refactor
red
   New code
       Write test before implementing class
       Internal workings of classes and methods
        should not matter
   Existing code
       Write test to reproduce bug
green
   Write least possible code to pass all tests
   Take shortcuts if necessary
refactor
   Refactor both implementation code and
    test code
   Change code without fear – you have
    automated tests!
   Remove implementation shortcuts – make
    sure software design makes sense
   Optimize for
    design/performance/maintainability
rinse and repeat!
Customer feedback on MS Test
• MS Test Framework Issues
  – MS-Test too slow
  – MS-Test missing new features
• Experience Issues
  – Designed for testers and not for developers
  – Not good for Agile & TDD
what’s new

        unit testing in
        visual studio 2012
The Visual Studio 2012 Unit
     Testing experience is
   focused on developers
writing and running unit tests
 while they write their code.
Yey new features!
•   Developer focused user experience
•   MS-Test improvements
•   Built-in and Third-party test frameworks
•   Continuous Testing
•   Debug Selected Tests
•   Code Coverage
Developer Focused User Experience
MS-Test Improvements
• Many performance and scale improvements
   – Especially when you stick to “classic” unit testing
• Support for testing Async
   [TestMethod]
   public async Task MyAsyncTest()
   {
      var result = await SomeLongRunningOperation();
      Assert.IsTrue( result );
   }


• Proper support for 64-bit and .Net multi-targeting
• Available in Express!
Supported Test Frameworks
• Built-in
  – .NET
  – Native C/C++
• Third-party
  – NUnit
  – xUnit.net
  – MbUnit
  – QUnit/Jasmine
  – Selenium
some ui testing in the web

        ui testing with nunit, selenium
        and visual studio 2012
Red Green Refactor
some genuine test driven development
        test driven development
        with nunit and visual
        studio 2012
Continuous Testing
• If you’re not testing you’re just compiling,
  not building
• Make sure you don’t break your code and
  tests – everytime you build!
Code Coverage
• Analyze your code
  coverage with a single
  click
• Analyze for selected
  tests to help find how
  specific tests are
  covering your system
• Supports all managed
  & native frameworks
Non C# unit testing coolness
• Unit Testing Browser-based Javascript
  (via Qunit/Jasmine)
• Unit Testing Native C++ Applications
let’s see it!


          demo
Just contact maybe :p
• twitter.com/lattex
• jonlimjap@gmail.com
• dotnet.kapenilattex.com
References
• Peter Provost:
  http://channel9.msdn.com/Events/TechEd/Europe/
  2012/DEV214?format=html5
• Jason Zander:
  http://blogs.msdn.com/b/jasonz/archive/2012/05/
  22/my-favorite-features-unit-testing-
  enhancements-in-visual-studio-11.aspx
• Ben Hall:
  http://blog.benhall.me.uk/2008/05/nxtgenug-
  coventry-red-green-refactor.html
• Anoop Shetty:
  http://anoopjshetty.wordpress.com/2012/02/08/cr
  eating-test-automation-framework-using-c-

More Related Content

What's hot (20)

PDF
Unit Testing Fundamentals
Richard Paul
 
PPTX
Test driven development in .Net - 2010 + Eclipse
UTC Fire & Security
 
PPTX
Unit Testing Concepts and Best Practices
Derek Smith
 
PPTX
Unit Testing
Sergey Podolsky
 
PDF
How and what to unit test
Eugenio Lentini
 
PPT
Automated Unit Testing
Mike Lively
 
PDF
Unit Testing
Scott Leberknight
 
ODP
Testing In Java
David Noble
 
PPT
Testing and Mocking Object - The Art of Mocking.
Deepak Singhvi
 
PPTX
Unit Testing (C#)
Prashant Cholachagudd
 
PPTX
Unit tests & TDD
Dror Helper
 
PPTX
Best practices unit testing
Tricode (part of Dept)
 
PPTX
An Introduction to Unit Testing
Joe Tremblay
 
PPTX
Unit Testing And Mocking
Joe Wilson
 
PDF
Unit testing, principles
Renato Primavera
 
PPTX
Unit testing
princezzlove
 
PPTX
Understanding Unit Testing
ikhwanhayat
 
PDF
Unit Testing 101
Dave Bouwman
 
PPTX
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove
 
Unit Testing Fundamentals
Richard Paul
 
Test driven development in .Net - 2010 + Eclipse
UTC Fire & Security
 
Unit Testing Concepts and Best Practices
Derek Smith
 
Unit Testing
Sergey Podolsky
 
How and what to unit test
Eugenio Lentini
 
Automated Unit Testing
Mike Lively
 
Unit Testing
Scott Leberknight
 
Testing In Java
David Noble
 
Testing and Mocking Object - The Art of Mocking.
Deepak Singhvi
 
Unit Testing (C#)
Prashant Cholachagudd
 
Unit tests & TDD
Dror Helper
 
Best practices unit testing
Tricode (part of Dept)
 
An Introduction to Unit Testing
Joe Tremblay
 
Unit Testing And Mocking
Joe Wilson
 
Unit testing, principles
Renato Primavera
 
Unit testing
princezzlove
 
Understanding Unit Testing
ikhwanhayat
 
Unit Testing 101
Dave Bouwman
 
Roy Osherove on Unit Testing Good Practices and Horrible Mistakes
Roy Osherove
 

Viewers also liked (10)

PDF
IT Risk Management & Leadership 30 March - 02 April 2014 Dubai UAE
360 BSI
 
PPTX
Visual Studio ALM 2013 - Edition Comparison
Steve Lange
 
PDF
Application Lifecycle management Utilizando ferramentas Microsoft
Luís Cesar Teodoro
 
PPTX
What's new in Visual Studio 2013 & TFS 2013
Danijel Malik
 
PPTX
Visual Studio Team Services Extensions by Taavi Kõosaar (@melborp)
.NET Crowd
 
PPTX
Advanced Coded UI Testing
Shai Raiten
 
PDF
Scrum with VS2010
Clemens Reijnen
 
PPSX
ASP.NET Web form
Md. Mahedee Hasan
 
PPTX
Scaling Agile: SAFe with Visual Studio Team Foundation Server
InCycle Software
 
PDF
Agile project management with visual studio tfs 2013 - My presentation at Reg...
Om Prakash Bang
 
IT Risk Management & Leadership 30 March - 02 April 2014 Dubai UAE
360 BSI
 
Visual Studio ALM 2013 - Edition Comparison
Steve Lange
 
Application Lifecycle management Utilizando ferramentas Microsoft
Luís Cesar Teodoro
 
What's new in Visual Studio 2013 & TFS 2013
Danijel Malik
 
Visual Studio Team Services Extensions by Taavi Kõosaar (@melborp)
.NET Crowd
 
Advanced Coded UI Testing
Shai Raiten
 
Scrum with VS2010
Clemens Reijnen
 
ASP.NET Web form
Md. Mahedee Hasan
 
Scaling Agile: SAFe with Visual Studio Team Foundation Server
InCycle Software
 
Agile project management with visual studio tfs 2013 - My presentation at Reg...
Om Prakash Bang
 
Ad

Similar to Unit testing, UI testing and Test Driven Development in Visual Studio 2012 (20)

DOCX
Tutorial test driven development with Visual Studio 2012
Hong Le Van
 
PPTX
Unit testing with visual studio 2012
Abhimanyu Singhal
 
PPTX
Unit Testing in VS2012
Gian Maria Ricci
 
PPTX
ALM@Work - Unit testing in Visual studio 2012
DomusDotNet
 
PPTX
Unit Testing and TDD 2017
Xavi Hidalgo
 
PPTX
Skillwise Unit Testing
Skillwise Group
 
PDF
03 test specification and execution
Clemens Reijnen
 
PPTX
Binary Studio Academy: .NET Code Testing
Binary Studio
 
PPTX
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Comunidade NetPonto
 
PPTX
NET Code Testing
Kirill Miroshnichenko
 
PPT
Automated testing overview
Alex Pop
 
PPTX
Implementing TDD in for .net Core applications
Ahmad Kazemi
 
PPTX
Unit tests and TDD
Roman Okolovich
 
PPTX
An Introduction to Unit Testing
Sahar Nofal
 
ODP
Js unit testingpresentation
Jonathan Gregory
 
PDF
Unit testing - An introduction
Alejandro Claro Mosqueda
 
PPTX
Unit testing basics with NUnit and Visual Studio
Amit Choudhary
 
PDF
Introduction to Automated Testing
Lars Thorup
 
PDF
Introduction to-automated-testing
BestBrains
 
ODP
Dot Net Notts Js Unit Testing at Microlise
Jonathan Gregory
 
Tutorial test driven development with Visual Studio 2012
Hong Le Van
 
Unit testing with visual studio 2012
Abhimanyu Singhal
 
Unit Testing in VS2012
Gian Maria Ricci
 
ALM@Work - Unit testing in Visual studio 2012
DomusDotNet
 
Unit Testing and TDD 2017
Xavi Hidalgo
 
Skillwise Unit Testing
Skillwise Group
 
03 test specification and execution
Clemens Reijnen
 
Binary Studio Academy: .NET Code Testing
Binary Studio
 
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Comunidade NetPonto
 
NET Code Testing
Kirill Miroshnichenko
 
Automated testing overview
Alex Pop
 
Implementing TDD in for .net Core applications
Ahmad Kazemi
 
Unit tests and TDD
Roman Okolovich
 
An Introduction to Unit Testing
Sahar Nofal
 
Js unit testingpresentation
Jonathan Gregory
 
Unit testing - An introduction
Alejandro Claro Mosqueda
 
Unit testing basics with NUnit and Visual Studio
Amit Choudhary
 
Introduction to Automated Testing
Lars Thorup
 
Introduction to-automated-testing
BestBrains
 
Dot Net Notts Js Unit Testing at Microlise
Jonathan Gregory
 
Ad

More from Jacinto Limjap (11)

PPTX
Maintainable UI Tests with Selenium and C#
Jacinto Limjap
 
PPTX
Refactoring to Microservices
Jacinto Limjap
 
PPTX
Donetconf2016: The Future of C#
Jacinto Limjap
 
ODP
C# and the Evolution of a Programming Language
Jacinto Limjap
 
PPTX
SQL vs NoSQL
Jacinto Limjap
 
PPTX
N-tier and oop - moving across technologies
Jacinto Limjap
 
PPTX
MSDN Ramp-Up Part 3: Business logic
Jacinto Limjap
 
PPT
Developing windows phone 7 applications
Jacinto Limjap
 
PPT
Automated Unit Testing in Silverlight for Windows Phone 7
Jacinto Limjap
 
PPTX
Dynamics & Object Runtime Composition with C# 4.0
Jacinto Limjap
 
PPTX
Three Developer Abilities They Dont Teach In College
Jacinto Limjap
 
Maintainable UI Tests with Selenium and C#
Jacinto Limjap
 
Refactoring to Microservices
Jacinto Limjap
 
Donetconf2016: The Future of C#
Jacinto Limjap
 
C# and the Evolution of a Programming Language
Jacinto Limjap
 
SQL vs NoSQL
Jacinto Limjap
 
N-tier and oop - moving across technologies
Jacinto Limjap
 
MSDN Ramp-Up Part 3: Business logic
Jacinto Limjap
 
Developing windows phone 7 applications
Jacinto Limjap
 
Automated Unit Testing in Silverlight for Windows Phone 7
Jacinto Limjap
 
Dynamics & Object Runtime Composition with C# 4.0
Jacinto Limjap
 
Three Developer Abilities They Dont Teach In College
Jacinto Limjap
 

Recently uploaded (20)

PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 

Unit testing, UI testing and Test Driven Development in Visual Studio 2012

  • 1. unit testing, ui testing, & test- driven development in visual studio 2012 Jon Limjap C# MVP
  • 2. Agenda • Overview of Unit Testing, UI Testing and Test Driven Development • Unit testing UI and code in Visual Studio 2012
  • 3. what’s up with all these tests? overview of unit testing, ui testing, and test driven development
  • 4. Let’s talk about unit testing • What is Unit Testing? • What is UI Testing? • What is Test Driven Development?
  • 5. What is a unit test? • Code that test a single unit of functionality (obviously!) • A single unit is any block of code that has ONE and only ONE responsibility: – Method – Function – Class
  • 6. What is User Interface Testing?  Using unit tests to validate user interaction  Automates user actions: clicking and typing  Automated UI tests allow your machine to do repetitive tasks across an application’s interface for you ;)
  • 7. What is Test Driven Development?  Using unit tests to design software  Allows change in code without fear of changing functionality  Produces loosely coupled objects and methods with single responsibilities  Unit tests become a tool to guide code design
  • 9. red  New code  Write test before implementing class  Internal workings of classes and methods should not matter  Existing code  Write test to reproduce bug
  • 10. green  Write least possible code to pass all tests  Take shortcuts if necessary
  • 11. refactor  Refactor both implementation code and test code  Change code without fear – you have automated tests!  Remove implementation shortcuts – make sure software design makes sense  Optimize for design/performance/maintainability
  • 13. Customer feedback on MS Test • MS Test Framework Issues – MS-Test too slow – MS-Test missing new features • Experience Issues – Designed for testers and not for developers – Not good for Agile & TDD
  • 14. what’s new unit testing in visual studio 2012
  • 15. The Visual Studio 2012 Unit Testing experience is focused on developers writing and running unit tests while they write their code.
  • 16. Yey new features! • Developer focused user experience • MS-Test improvements • Built-in and Third-party test frameworks • Continuous Testing • Debug Selected Tests • Code Coverage
  • 18. MS-Test Improvements • Many performance and scale improvements – Especially when you stick to “classic” unit testing • Support for testing Async [TestMethod] public async Task MyAsyncTest() { var result = await SomeLongRunningOperation(); Assert.IsTrue( result ); } • Proper support for 64-bit and .Net multi-targeting • Available in Express!
  • 19. Supported Test Frameworks • Built-in – .NET – Native C/C++ • Third-party – NUnit – xUnit.net – MbUnit – QUnit/Jasmine – Selenium
  • 20. some ui testing in the web ui testing with nunit, selenium and visual studio 2012
  • 22. some genuine test driven development test driven development with nunit and visual studio 2012
  • 23. Continuous Testing • If you’re not testing you’re just compiling, not building • Make sure you don’t break your code and tests – everytime you build!
  • 24. Code Coverage • Analyze your code coverage with a single click • Analyze for selected tests to help find how specific tests are covering your system • Supports all managed & native frameworks
  • 25. Non C# unit testing coolness • Unit Testing Browser-based Javascript (via Qunit/Jasmine) • Unit Testing Native C++ Applications
  • 27. Just contact maybe :p • twitter.com/lattex • [email protected] • dotnet.kapenilattex.com
  • 28. References • Peter Provost: http://channel9.msdn.com/Events/TechEd/Europe/ 2012/DEV214?format=html5 • Jason Zander: http://blogs.msdn.com/b/jasonz/archive/2012/05/ 22/my-favorite-features-unit-testing- enhancements-in-visual-studio-11.aspx • Ben Hall: http://blog.benhall.me.uk/2008/05/nxtgenug- coventry-red-green-refactor.html • Anoop Shetty: http://anoopjshetty.wordpress.com/2012/02/08/cr eating-test-automation-framework-using-c-

Editor's Notes

  • #2: Hi my name is Jon Limjap, I’m a Microsoft Most Valuable Professional for C#,
  • #3: This afternoon I’m going to discuss about unit testing, test driven development, C# and the new unit testing features of Visual Studio 2012
  • #5: Ask the audience these questions:How do they define unit testing?Do they use unit testing at work?How do they define test-driven development?Do they use test driven development at work?
  • #8: Unit testing is all about object oriented programmingTest driven development was designed to keep you from overdesigning and overcomplicating your API
  • #9: RedNew codeWrite test before implementing classInternal workings of classes and methods should not matterExisting codeWrite test to reproduce bugGreenWrite least possible code to pass all testsTake shortcuts if necessaryRefactorRefactor both implementation code and test codeChange code without fear – you have automated tests!Remove implementation shortcuts – make sure software design makes senseOptimize for design/performance/maintainability
  • #14: The main problem with Visual Studio is that it couldn’t do TDD
  • #16: Whether or not you write test-first test driven development style or test-after, the best time to write your tests is while you’re writing relevant code
  • #17: I don’t have time to demo all of these so we’ll only demo some
  • #22: RedNew codeWrite test before implementing classInternal workings of classes and methods should not matterExisting codeWrite test to reproduce bugGreenWrite least possible code to pass all testsTake shortcuts if necessaryRefactorRefactor both implementation code and test codeChange code without fear – you have automated tests!Remove implementation shortcuts – make sure software design makes senseOptimize for design/performance/maintainability
  • #24: To build is to build a working product, not a broken oneThe faster we know that we broke