Re: [Tutor] duplication in unit tests

2009-12-09 Thread spir
Serdar Tumgoren dixit: > I'll admit, I learned the hard way on a project earlier this year. I > got that project done (again with the help of folks on this list), but > didn't do any test-writing up front. And now, as the inevitable bugs > crop up, I'm forced to patch them hoping that I don't bre

Re: [Tutor] duplication in unit tests

2009-12-09 Thread Serdar Tumgoren
> Yes, this is much better. Notice how much less code it is! :-) Yes, it was amazing to see how much code melted away when I gave up on the OO design. As you and others suggested, clearly this was not the correct approach for this portion of my program. > If you expect unicode input then it makes

Re: [Tutor] duplication in unit tests

2009-12-09 Thread spir
Serdar Tumgoren dixit: > Hi everyone, > I'm trying to apply some lessons from the recent list discussions on > unit testing and Test-Driven Development, but I seem to have hit a > sticking point. > > As part of my program, I'm planning to create objects that perform > some initial data clean-up

Re: [Tutor] duplication in unit tests

2009-12-08 Thread Dave Angel
Serdar Tumgoren wrote: Hi Kent and Lie, First, thanks to you both for the help. I reworked the tests and then the main code according to your suggestions (I really was muddling these TDD concepts!). The reworked code and tests are below. In the tests, I hard-coded the source data and the expect

Re: [Tutor] duplication in unit tests

2009-12-08 Thread Kent Johnson
On Tue, Dec 8, 2009 at 10:11 PM, Serdar Tumgoren wrote: > Hi Kent and Lie, > > First, thanks to you both for the help. I reworked the tests and then > the main code according to your suggestions (I really was muddling > these TDD concepts!). > > The reworked code and tests are below. In the tests,

Re: [Tutor] duplication in unit tests

2009-12-08 Thread Serdar Tumgoren
Hi Kent and Lie, First, thanks to you both for the help. I reworked the tests and then the main code according to your suggestions (I really was muddling these TDD concepts!). The reworked code and tests are below. In the tests, I hard-coded the source data and the expected results; in the main p

Re: [Tutor] duplication in unit tests

2009-12-08 Thread Lie Ryan
On 12/9/2009 10:43 AM, Kent Johnson wrote: So my questions -- Am I misunderstanding how to properly write unit tests for this case? Or perhaps I've structured my program incorrectly, and that's what this duplication reveals? I suspected, for instance, that perhaps I should group these methods (co

Re: [Tutor] duplication in unit tests

2009-12-08 Thread Kent Johnson
On Tue, Dec 8, 2009 at 6:02 PM, Serdar Tumgoren wrote: > As part of my program, I'm planning to create objects that perform > some initial data clean-up and then parse and database the cleaned > data. Currently I'm expecting to have a FileCleaner and Parser > classes. Using the TDD approach, I've

[Tutor] duplication in unit tests

2009-12-08 Thread Serdar Tumgoren
Hi everyone, I'm trying to apply some lessons from the recent list discussions on unit testing and Test-Driven Development, but I seem to have hit a sticking point. As part of my program, I'm planning to create objects that perform some initial data clean-up and then parse and database the cleaned