-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Shlomi Fish wrote: > Now we only have to cover the outcomes of the condition in only one function. > (or two different outcomes in different functions). So our test coverage is > not as comprehensive as the previous one. Well, I don't think that the test is now less comprehensive. Waving the hands a bit here, I'd say that the fact that you managed to do the refactoring tells us something about the code structure (e.g. there are no lexical variables used inside the "if(CONDITION)" block) which in turn hints at the coverage previously being redundant (that is, the code *not* in the "if(CONDITION)" block was being exercised in the same way by both branch-coverage tests).
I feel it's OK that refactoring, by simplifying the code, would also simplify the tests, coverage level being otherwise equal. > > Right now an ad-hoc solution is to make sure that one has a good test coverage > before one refactors the code. Can't hurt, but the real "philosophical" issue here IMHO is whether you should delete your tests that don't contribute towards your coverage anymore. I am of the opinion that it depends what the tests were created for in the first place. If they cover a bug or express a requirement, they should be kept; if they were intended to improve coverage they are now obviously useless. I always document my tests with a one-liner for this reason (just to keep track of *why* they exist). Regards, - -- << Tout n'y est pas parfait, mais on y honore certainement les jardiniers >> Dominique Quatravaux <[EMAIL PROTECTED]> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQCVAwUBRaijvvTYH7KfeIIFAQIuYQP+NLb0Ugj+ZWikzDVghrNsM+ec+rIpK2TQ 89D2yQngaqbtmwZjEDyoJjPmwP1MoQ+a7ENFxUgt4XvvIkTv0hetcCNyY5h6dZzD qiO/+L56Y9loFM2lQO0YdGHbj4bW6694tgHlEtWwQv4mASSvlGo3Ic23w9BSKOOB bLYp20UYB+g= =F76W -----END PGP SIGNATURE-----