testing asp.net web applications
DESCRIPTION
Presentation for NxtGenUG Southampton on Thursday, August 20, 2009 on how to test ASP.net web applicationsTRANSCRIPT
![Page 2: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/2.jpg)
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
![Page 3: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/3.jpg)
TONIGHT
• Test Driven Development (TDD)• Integration Testing• UI Testing• Acceptance Testing• Q\A
![Page 4: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/4.jpg)
TEST DRIVEN DEVELOPMENT
![Page 5: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/5.jpg)
TDD is not about testing!
Tests are a useful by-product
![Page 6: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/6.jpg)
TDD helps you think about design
Take a step back and think!
![Page 7: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/7.jpg)
Loosely coupled system
![Page 8: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/8.jpg)
http://www.flickr.com/photos/clarkk/38817024/
![Page 9: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/9.jpg)
Support debugging
![Page 10: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/10.jpg)
Documentation for your code
![Page 11: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/11.jpg)
/* * 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
![Page 12: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/12.jpg)
Support refactoring
![Page 13: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/13.jpg)
If it hurts – think!
![Page 14: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/14.jpg)
It’s all about the mindset
![Page 15: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/15.jpg)
Test Code 101
[TestFixture]public class ObjectUnderTestTests{ [Test] public void
MethodUnderTest_State_ExpectedBehaviour(){ string result = Convert.ToString(true); Assert.IsTrue(result);}
}
NUnit Attribute – Class contains tests
NUnit Attribute – This is a test
![Page 16: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/16.jpg)
Disclaimer: This was a Hello World Linq to SQL example. Not a recommendation.
![Page 17: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/17.jpg)
TDD + ASP.net WebForms
DEMO
![Page 18: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/18.jpg)
TDD + ASP.net MVC
DEMO
![Page 19: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/19.jpg)
RememberIt’s all about the mindset
![Page 20: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/20.jpg)
INTEGRATION TESTING
![Page 21: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/21.jpg)
Removing the stubs
![Page 22: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/22.jpg)
Handling ASP.net
DEMO
![Page 23: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/23.jpg)
Handling databases
DEMO
![Page 24: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/24.jpg)
Handling external services
DEMO
![Page 25: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/25.jpg)
http://www.flickr.com/photos/gagilas/2659695352/
LEGACY TESTING
![Page 26: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/26.jpg)
UI TESTING
![Page 27: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/27.jpg)
IETester
![Page 28: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/28.jpg)
IETester
![Page 29: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/29.jpg)
Browsershots
![Page 30: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/30.jpg)
Opera 8.54 / Windows XP
![Page 31: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/31.jpg)
Adobe Browser Lab
![Page 32: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/32.jpg)
http://www.flickr.com/photos/gagilas/2659695352/
RECORD AND PLAYBACK
![Page 33: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/33.jpg)
Automated UI Testing - WatiN
DEMO
![Page 34: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/34.jpg)
WatiN + jQuery + Ajax
DEMO
![Page 35: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/35.jpg)
UI tests are not without their problems
![Page 36: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/36.jpg)
ACCEPTANCE TESTING
![Page 37: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/37.jpg)
The customer is always right
![Page 38: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/38.jpg)
Have them involved in the testing process
![Page 39: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/39.jpg)
FitNesse
![Page 40: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/40.jpg)
![Page 41: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/41.jpg)
![Page 42: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/42.jpg)
![Page 43: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/43.jpg)
Behaviour Driven Development - BDD
![Page 44: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/44.jpg)
Cucumber + Watir
DEMO
![Page 45: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/45.jpg)
http://www.flickr.com/photos/leon_homan/2856628778/
Summary
![Page 46: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/46.jpg)
Lots more we could discuss
Most of which is covered in the book
![Page 47: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/47.jpg)
Need to try it for yourself to see true benefits
![Page 48: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/48.jpg)
Tomorrow: Write one method using TDD and one UI test
![Page 50: Testing ASP.net Web Applications](https://reader033.vdocuments.us/reader033/viewer/2022061216/54b3b2534a7959994b8b469c/html5/thumbnails/50.jpg)
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