TESTING ASP.NET WEB APPLICATIONSTwitter - @Ben_HallBlog.BenHall.me.ukBen@BenHall.me.uk
Based on the book “Testing ASP.NET Web Applications “By Jeff McWherter, Ben HallISBN-10: 0470496649 ISBN-13: 978-0470496640Publisher: John Wiley & Sons (12 Nov 2009)http://www.amazon.co.uk/Testing-ASP-NET-Applications-Jeff-McWherter/dp/0470496649
TONIGHTTest Driven Development (TDD)Integration TestingUI TestingAcceptance TestingQ\A
Test driven development
TDD is not about testing!Tests are a useful by-product
TDD helps you think about designTake a step back and think!
Loosely coupled system
http://www.flickr.com/photos/clarkk/38817024/
Support debugging
Documentation for your code
/*  * Every time I re-visit this function, I feel like * I need to take a shower. * * Don't get too used to this function, its days  * are numbered.*/http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered
Support refactoring
If it hurts – think!
It’s all about the mindset
Test Code 101NUnit Attribute – Class contains tests[TestFixture]public class ObjectUnderTestTests{   [Test]   public void MethodUnderTest_State_ExpectedBehaviour(){   string result = Convert.ToString(true);Assert.IsTrue(result);}}NUnit Attribute – This is a test
Disclaimer: This was a Hello World Linq to SQL example. Not a recommendation.
TDD + ASP.net WebFormsDEMO
TDD + ASP.net MVCDEMO
RememberIt’s all about the mindset
Integration testing
Removing the stubs
Handling ASP.netDEMO
Handling databasesDEMO
Handling external servicesDEMO
LEGACY TESTINGhttp://www.flickr.com/photos/gagilas/2659695352/
Ui testing
IETester
IETester
Browsershots
Opera 8.54 / Windows XP
Adobe Browser Lab
RECORD AND PLAYBACKhttp://www.flickr.com/photos/gagilas/2659695352/
Automated UI Testing - WatiNDEMO
WatiN + jQuery + AjaxDEMO
UI tests are not without their problems
Acceptance testing
The customer is always right
Have them involved in the testing process
FitNesse
Behaviour Driven Development - BDD
Cucumber + WatirDEMO
Summaryhttp://www.flickr.com/photos/leon_homan/2856628778/
Lots more we could discussMost of which is covered in the book
Need to try it for yourselftosee true benefits
Tomorrow: Write one method using TDD and one UI test
Thank you!Twitter - @Ben_HallBlog.BenHall.me.ukBen@BenHall.me.uk
Based on the book “Testing ASP.NET Web Applications “By Jeff McWherter, Ben HallISBN-10: 0470496649 ISBN-13: 978-0470496640Publisher: John Wiley & Sons (12 Nov 2009)http://www.amazon.co.uk/Testing-ASP-NET-Applications-Jeff-McWherter/dp/0470496649

Testing ASP.net Web Applications