|
From: <rdr...@ar...> - 2007-09-13 08:39:34
|
Currently my tests are not brittle... I was explaining the the missing ability to override an existing stub would make the tests more brittle. I finally gave in and will "reverse the setup", but i still feel its odd... and it will cause me to add "extra" initialisation code into my test methods... (Which was hidden inside the [setup] before, since it was unimportant to the test) I feel if JMock had the ability to override, and the sequence in which the expections are evaluated is reversed, then there is a feature that has been removed... Its a feature I expected so naturally, i was quite confused when it was not there... Dont get me wrong though... I love NMock and enjoy using it... Or else i wouldnt complain ;) ----- Original Nachricht ---- Von: Nat Pryce <nat...@gm...> An: NMock2 Development Discussion <nmo...@li...> Datum: 12.09.2007 21:44 Betreff: Re: [NMock2-Dev] Feature Request: "Stub" should have alower prioritythen "Expect" > One thing that might be worth investigating is why the tests are so > brittle. Why does a change to a class (adding a new event) cause many > tests that are testing other aspects of that class to fail. Maybe > events can be split up somehow and tested separately. > > --Nat > > On 12/09/2007, rdr...@ar... <rdr...@ar...> wrote: > > The problem still remains... > > > > I would have to do a lot more "Copy&Paste" inheritance if i am unable to > override a speccific setup. For a simple view with 5 Events i would have to > create 5 different setup functions, which would all differe in one line. And > there is no way to refactor this out. > > > > Thats 25 (n^2) Lines of mock setup vs 10 (2 * n) lines... and the number > only gets bigger for more events. The code is not complex, but it leads to > maintenance problems if there is a change... > > > > If I want to add another event to the view, this would cause no less then > 5 failed tests, and force me to update 5 Setup-functions, and create a new > one from scratch (by Copy and Paste). on the other Version I would only have > to update the generic setup function, and then add one event in my > test-method... (or use the hack which I find ugly...) > > > > I like my testcases very short and simple... I usualy feel bad when they > reach 10 lines, since I consider that to complex... > > > > Hope this makes sense... > > > > Heiko |