Your SlideShare is downloading. ×
0
unit testing, ui testing, & test-driven development in visualstudio 2012Jon LimjapC# 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...
What is User Interface Testing?   Using unit tests to validate user    interaction   Automates user actions: clicking an...
What is Test DrivenDevelopment?   Using unit tests to design software   Allows change in code without fear of    changin...
Red Green Refactor
red   New code       Write test before implementing class       Internal workings of classes and methods        should ...
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!...
rinse and repeat!
Customer feedback on MS Test• MS Test Framework Issues  – MS-Test too slow  – MS-Test missing new features• Experience Iss...
what’s new        unit testing in        visual studio 2012
The Visual Studio 2012 Unit     Testing experience is   focused on developerswriting and running unit tests while they wri...
Yey new features!•   Developer focused user experience•   MS-Test improvements•   Built-in and Third-party test frameworks...
Developer Focused User Experience
MS-Test Improvements• Many performance and scale improvements   – Especially when you stick to “classic” unit testing• Sup...
Supported Test Frameworks• Built-in  – .NET  – Native C/C++• Third-party  – NUnit  – xUnit.net  – MbUnit  – QUnit/Jasmine ...
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  t...
Code Coverage• Analyze your code  coverage with a single  click• Analyze for selected  tests to help find how  specific te...
Non C# unit testing coolness• Unit Testing Browser-based Javascript  (via Qunit/Jasmine)• Unit Testing Native C++ Applicat...
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:...
Upcoming SlideShare
Loading in...5
×

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

4,966

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
4,966
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
74
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Hi my name is Jon Limjap, I’m a Microsoft Most Valuable Professional for C#,
  • This afternoon I’m going to discuss about unit testing, test driven development, C# and the new unit testing features of Visual Studio 2012
  • 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?
  • Unit testing is all about object oriented programmingTest driven development was designed to keep you from overdesigning and overcomplicating your API
  • 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
  • The main problem with Visual Studio is that it couldn’t do TDD
  • 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
  • I don’t have time to demo all of these so we’ll only demo some
  • 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
  • To build is to build a working product, not a broken oneThe faster we know that we broke
  • Transcript of "Unit testing, UI testing and Test Driven Development in Visual Studio 2012"

    1. 1. unit testing, ui testing, & test-driven development in visualstudio 2012Jon LimjapC# MVP
    2. 2. Agenda• Overview of Unit Testing, UI Testing and Test Driven Development• Unit testing UI and code in Visual Studio 2012
    3. 3. what’s up with all these tests? overview of unit testing, ui testing, and test driven development
    4. 4. Let’s talk about unit testing• What is Unit Testing?• What is UI Testing?• What is Test Driven Development?
    5. 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. 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. 7. What is Test DrivenDevelopment? 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
    8. 8. Red Green Refactor
    9. 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. 10. green Write least possible code to pass all tests Take shortcuts if necessary
    11. 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
    12. 12. rinse and repeat!
    13. 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. 14. what’s new unit testing in visual studio 2012
    15. 15. The Visual Studio 2012 Unit Testing experience is focused on developerswriting and running unit tests while they write their code.
    16. 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
    17. 17. Developer Focused User Experience
    18. 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. 19. Supported Test Frameworks• Built-in – .NET – Native C/C++• Third-party – NUnit – xUnit.net – MbUnit – QUnit/Jasmine – Selenium
    20. 20. some ui testing in the web ui testing with nunit, selenium and visual studio 2012
    21. 21. Red Green Refactor
    22. 22. some genuine test driven development test driven development with nunit and visual studio 2012
    23. 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. 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. 25. Non C# unit testing coolness• Unit Testing Browser-based Javascript (via Qunit/Jasmine)• Unit Testing Native C++ Applications
    26. 26. let’s see it! demo
    27. 27. Just contact maybe :p• twitter.com/lattex• jonlimjap@gmail.com• dotnet.kapenilattex.com
    28. 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-
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×