• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Pex
 

Pex

on

  • 552 views

DDD7

DDD7

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

Statistics

Views

Total Views
552
Views on SlideShare
552
Embed Views
0

Actions

Likes
1
Downloads
4
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • 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/

Pex Pex Presentation Transcript

  • PexThe future of unit testing? Ben Hall Ben@BenHall.me.uk Blog.BenHall.me.uk
  • Agenda• What is Pex?• Problem Pex is trying to solve• Pex in the Real World• The future?
  • What is Pex?
  • Program Exploration
  • Microsoft ResearchResearch in Software Engineering (RiSE)
  • Nikolai TillmannPeli de HalleuxWolfram SchulteNikolaj Bjørner
  • Nikolai TillmannPeli de HalleuxWolfram SchulteNikolaj Bjørner
  • Pex generates inputs for your unittests through automate exploratory testing
  • 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
  • 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);}
  • 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);}
  • Everything Ian said is still valid
  • Exploratory Testing• Learns more over time• More it knows, more it knows how to break it• Starts with simplest input
  • DEMOHELLO WORLD
  • Under the covers
  • CLR Profiler APIICorProfilerCallback2
  • Z3 Constraint Solver
  • The Problem
  • Some people aren’t unit testing Ok... Most people
  • Lots of people think they arewriting tests but in reality they aren’t
  • [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));}
  • Those who are, 100% code coverage is rare Especially with Legacy Code
  • Test Driven Development on complex code is difficult
  • Encryption and Decryption algorithms
  • Parsers and Compilers
  • Decision Tables
  • Aim of Pex is to solve these problems
  • The Real World
  • DEMODECISION TABLE
  • DEMOIP ADDRESS GENERATOR
  • DEMOPEX EXTENSIONS
  • The Future
  • Pex has limitationsRemember – it’s still research
  • Difficult to start usingRemember – it’s still research
  • Not available under a commercial license VS2008 == ResearchVS2010 == Same as VS2010 CTP
  • However!
  • Very good with algorithms and complex code
  • Used internally to test core component at Microsoft
  • Code Contracts help guide Pex Spec# C# 4.0
  • BDD and Pex
  • In summary...
  • Summary• Pex is a project from Microsoft research• Available today for VS2008 and VS2010• Aims to make unit testing more effective• BDD + Pex
  • Thank you Ben HallBen@BenHall.me.ukBlog.BenHall.me.uk
  • 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
  • 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/