Post-hoc unit testing, and increasing the unit test coverage rate?
-
I currently have a sizable code base with LinFu that I can't afford to rewrite from scratch, and I want to increase the code coverage rate on existing portions of the library which don't have any coverage at all. Is there any way to apply unit tests to existing code and increase the coverage rate, or is this an exercise in futility?
Do you know...LinFu?
-
I currently have a sizable code base with LinFu that I can't afford to rewrite from scratch, and I want to increase the code coverage rate on existing portions of the library which don't have any coverage at all. Is there any way to apply unit tests to existing code and increase the coverage rate, or is this an exercise in futility?
Do you know...LinFu?
Philip Laureano wrote:
Is there any way to apply unit tests to existing code
Couldn't you use LinFu to do that? :confused: I just spent like two minutes looking at your LinFu and that was the first thing I thought of. Also though, I have used NUnit for several years and I find the quote above from you a bit confusing because of course you can apply unit tests to existing code. I must be missing something. :confused:
led mike
-
Philip Laureano wrote:
Is there any way to apply unit tests to existing code
Couldn't you use LinFu to do that? :confused: I just spent like two minutes looking at your LinFu and that was the first thing I thought of. Also though, I have used NUnit for several years and I find the quote above from you a bit confusing because of course you can apply unit tests to existing code. I must be missing something. :confused:
led mike
led mike wrote:
Couldn't you use LinFu to do that? [Confused] I just spent like two minutes looking at your LinFu and that was the first thing I thought of. Also though, I have used NUnit for several years and I find the quote above from you a bit confusing because of course you can apply unit tests to existing code. I must be missing something.
Hi Mike, Sorry for the confusion. This question is more of a philosophical question rather than a technical one, so I'll go ahead and rephrase it: "Should unit testing be applied to an existing code base that already works?" If the rest of the code base changes very little, wouldn't the tests themselves be a case of YAGNI?
led mike wrote:
Couldn't you use LinFu to do that?
I suppose LinFu could "dogfood" itself and put the tests everywhere, but that's beside the point. The real question here is that is there really any value (read: value = quality) gained in adding unit tests for code that has already been proven to work on an innumerable amount of occasions?
-
led mike wrote:
Couldn't you use LinFu to do that? [Confused] I just spent like two minutes looking at your LinFu and that was the first thing I thought of. Also though, I have used NUnit for several years and I find the quote above from you a bit confusing because of course you can apply unit tests to existing code. I must be missing something.
Hi Mike, Sorry for the confusion. This question is more of a philosophical question rather than a technical one, so I'll go ahead and rephrase it: "Should unit testing be applied to an existing code base that already works?" If the rest of the code base changes very little, wouldn't the tests themselves be a case of YAGNI?
led mike wrote:
Couldn't you use LinFu to do that?
I suppose LinFu could "dogfood" itself and put the tests everywhere, but that's beside the point. The real question here is that is there really any value (read: value = quality) gained in adding unit tests for code that has already been proven to work on an innumerable amount of occasions?
Philip Laureano wrote:
The real question here is that is there really any value (read: value = quality) gained in adding unit tests for code that has already been proven to work on an innumerable amount of occasions?
If you're never ever going to change the code again - no. If there's the possibility that the code could change - yes. The unit tests will help give you confidence that your code still works post changes, which is (obviously) hugely important.
Deja View - the feeling that you've seen this post before.
-
led mike wrote:
Couldn't you use LinFu to do that? [Confused] I just spent like two minutes looking at your LinFu and that was the first thing I thought of. Also though, I have used NUnit for several years and I find the quote above from you a bit confusing because of course you can apply unit tests to existing code. I must be missing something.
Hi Mike, Sorry for the confusion. This question is more of a philosophical question rather than a technical one, so I'll go ahead and rephrase it: "Should unit testing be applied to an existing code base that already works?" If the rest of the code base changes very little, wouldn't the tests themselves be a case of YAGNI?
led mike wrote:
Couldn't you use LinFu to do that?
I suppose LinFu could "dogfood" itself and put the tests everywhere, but that's beside the point. The real question here is that is there really any value (read: value = quality) gained in adding unit tests for code that has already been proven to work on an innumerable amount of occasions?
Philip Laureano wrote:
If the rest of the code base changes very little, wouldn't the tests themselves be a case of YAGNI?
Why not simply add the tests once you do need to change the code? As you say, if it won't change then it's pretty pointless. On the other hand, you might find a bug or two in the existing code if you add tests.