Your SlideShare is downloading. ×

Pex

413

Published on

DDD7 …

DDD7

http://blog.benhall.me.uk/2008/11/ddd7-slides-and-code-pex-future-of-unit.html

Published in: Technology, Sports
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
413
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • http://www.flickr.com/search/?q=weather+sunny&l=4&page=2http://www.flickr.com/photos/djbrady/1460272108/
  • http://www.flickr.com/search/?q=storm+lightning&s=int&l=4http://www.flickr.com/photos/yukonblizzard/2562986305/
  • http://www.flickr.com/search/?q=fog+forest&l=4&page=2http://www.flickr.com/photos/frielp/6829509/
  • http://www.flickr.com/photos/atomicjeep/274667176/
  • http://www.flickr.com/search/?l=4&w=all&q=weather+cloudy&m=texthttp://www.flickr.com/photos/wouterpostma/695850212/
  • http://www.flickr.com/photos/leon_homan/2856628778/
  • http://xkcd.com/303/
  • Adapted from http://xkcd.com/303/
  • Transcript

    • 1. PexThe future of unit testing? Ben Hall Ben@BenHall.me.uk Blog.BenHall.me.uk
    • 2. Agenda• What is Pex?• Problem Pex is trying to solve• Pex in the Real World• The future?
    • 3. What is Pex?
    • 4. Program Exploration
    • 5. Microsoft ResearchResearch in Software Engineering (RiSE)
    • 6. Nikolai TillmannPeli de HalleuxWolfram SchulteNikolaj Bjørner
    • 7. Nikolai TillmannPeli de HalleuxWolfram SchulteNikolaj Bjørner
    • 8. Pex generates inputs for your unittests through automate exploratory testing
    • 9. Identify Test Inputs• Pex doesn’t make wild guesses• Pex gains an understanding of your code• Static and dynamic analysis• Every input should increase code coverage
    • 10. Parameterised Unit Tests[RowTest][Row(1, 2, 3)][Row(-1, -2, -3)]public void TestForAddMethod(int a, int b, intexpected){ int test = MyMethods.Add(a, b); Assert.AreEqual(test, expected);}
    • 11. Parameterised Unit Tests[RowTest][Row(1, 2, 3)][Row(-1, -2, -3)]public void TestForAddMethod(int a, int b, intexpected){ int test = MyMethods.Add(a, b); Assert.AreEqual(test, expected);}
    • 12. Everything Ian said is still valid
    • 13. Exploratory Testing• Learns more over time• More it knows, more it knows how to break it• Starts with simplest input
    • 14. DEMOHELLO WORLD
    • 15. Under the covers
    • 16. CLR Profiler APIICorProfilerCallback2
    • 17. Z3 Constraint Solver
    • 18. The Problem
    • 19. Some people aren’t unit testing Ok... Most people
    • 20. Lots of people think they arewriting tests but in reality they aren’t
    • 21. [Test]public void Test1(){ Engine e = new Engine(); Customer c = e.GetCustomer(123); Order o = new Order(1, “Product X”) o.Customer = c; Assert.IsTrue(e.PlaceOrder(o));}
    • 22. Those who are, 100% code coverage is rare Especially with Legacy Code
    • 23. Test Driven Development on complex code is difficult
    • 24. Encryption and Decryption algorithms
    • 25. Parsers and Compilers
    • 26. Decision Tables
    • 27. Aim of Pex is to solve these problems
    • 28. The Real World
    • 29. DEMODECISION TABLE
    • 30. DEMOIP ADDRESS GENERATOR
    • 31. DEMOPEX EXTENSIONS
    • 32. The Future
    • 33. Pex has limitationsRemember – it’s still research
    • 34. Difficult to start usingRemember – it’s still research
    • 35. Not available under a commercial license VS2008 == ResearchVS2010 == Same as VS2010 CTP
    • 36. However!
    • 37. Very good with algorithms and complex code
    • 38. Used internally to test core component at Microsoft
    • 39. Code Contracts help guide Pex Spec# C# 4.0
    • 40. BDD and Pex
    • 41. In summary...
    • 42. Summary• Pex is a project from Microsoft research• Available today for VS2008 and VS2010• Aims to make unit testing more effective• BDD + Pex
    • 43. Thank you Ben HallBen@BenHall.me.ukBlog.BenHall.me.uk
    • 44. Resources• http://Blog.BenHall.me.uk• http://research.microsoft.com/pex/• http://www.codeplex.com/pex• http://blog.dotnetwiki.org/ (Peli’s Blog)• http://blogs.msdn.com/nikolait• PDC Session - http://channel9.msdn.com/pdc2008/TL51
    • 45. Flickr Images• http://www.flickr.com/photos/djbrady/1460272108/• http://www.flickr.com/photos/yukonblizzard/2562986 305/• http://www.flickr.com/photos/frielp/6829509/• http://www.flickr.com/photos/atomicjeep/274667176/• http://www.flickr.com/photos/wouterpostma/6958502 12/• http://www.flickr.com/photos/leon_homan/28566287 78/• http://www.flickr.com/photos/sadsnaps/2741479621/

    ×