Chiaro Scuro wrote: > On 3/5/06, E. Saynatkari <none / none.net> wrote: >> Esad Hajdarevic wrote: >> If your unit tests do not cover everything, how can >> any other kinds? :) >> >> > Esad > > These are two different issues. > > Your asserts/contracts should check that the methods are being passed > what they expect to be passed to them. Postconditions will probably > check some invariants on the results of the methods. Yes, I agree, and this was partly the point I was making. There are situations where functional tests are required and there are some things that just require real-time constraints (any non-predetermined input, usually). > Your test should not test what the contracts already check. The tests > should check that if you pass correct values you get the expected > results. > > Eg: assume that you have a method that takes only positive numbers. > you will have a contract/assertion checking that you don't pass any > negatives and a test suite that checks that, given a set of positive > inputs, you get the correct outputs. Or, instead, you could in many circumstances ascertain that the method that produces the input does not produce negative numbers; this is something that a unit test would do and it would eliminate the need of a constraint :) E -- Posted via http://www.ruby-forum.com/.