lundi 6 juin 2011
C# training day 1
Par Nicolas, lundi 6 juin 2011 à 16:15 :: geek stuff
Aller au contenu | Aller au menu | Aller à la recherche
lundi 6 juin 2011
Par Nicolas, lundi 6 juin 2011 à 16:15 :: geek stuff
lundi 15 janvier 2007
Par Nicolas, lundi 15 janvier 2007 à 16:57 :: geek stuff
Let's say you are a programmer.
Let's say you are aware of the traps a big IT project can fall into, and you decide to adopt a test driven approach.
On the next day, you find out that this huge (900 md) part of the code that is done by this other contractor will not be delivered until 2009, and of course you need this part to test your code...Treat yourself and build a mock object that will simulate the behaviour of the missing part of the code !
Wikipedia says you normally need this (these) mock object because this damn contractor code :
A proper conception of your mock object will be the following :
Upon a commonly agreed interface with the ... contractor :
Ok, but a test class can do the job, why would i want a mockup?
Probably in the cases where you interact with some objects that are complex to mimic (you do not want to build them in messy test cases), when these objects are slow to build, or cost time to calculate (remember a big project usually involves a suite of hundreds of test, and the suite needs to be run fast...), when you need to test states like DB is down, but you do not want to stop the db to run your test