Re: [TDD] How do you go about splitting a class using TDD?
Niels Krijger wrote on 11.9.2012 0:01: The tests are written (one at a time) before the the production code which passes them. In other words, TDD. The tests are written after the production code
By
Esko Luontola
·
#35120
·
|
Re: [TDD] How do you go about splitting a class using TDD?
Hi Esko, Sorry this is quite off-topic. You (Esko) seem to have a very clear grasp on the definitions used in your reply which made it a bit confusing to interpret your message. In particular I'm
By
Niels Krijger <niels@...>
·
#35119
·
|
Re: [TDD] How do you go about splitting a class using TDD?
Kaleb Pederson wrote on 10.9.2012 19:39: I'm doing it similar to Kaleb. After extracting the new class, I look at its code to see what are its responsibilities/features, and then write tests for each
By
Esko Luontola
·
#35118
·
|
Re: [TDD] How do you go about splitting a class using TDD?
I never actually have this problem, and it sounds to me like you have a problem with your process. You see, if you just spent some more time on making sure you got the requirements exactly right and
By
Nayan Hajratwala
·
#35117
·
|
Re: [TDD] How do you go about splitting a class using TDD?
I kinda do it like Angel, except when I write A2 using TDD, it is a process of moving each test specific to the behavior to A2Test and rewriting it (probably cleaner, with less mocking and
By
John Goodsen <jgoodsen@...>
·
#35116
·
|
Re: [TDD] How do you go about splitting a class using TDD?
On Mon, Sep 10, 2012 at 2:34 AM, arnonaxelrod <arnonaxelrod@...> wrote: ... > 2. Change one copy of the test to use a mock instead of the 1st > class, and the other copy of the test to use a
By
Kaleb Pederson
·
#35115
·
|
Re: [TDD] How do you go about splitting a class using TDD?
Hmmm.... Let A the original class. Let A1, A2 your imagined new classes, attending responsibilities R1, R2. I would write A2, using TDD. Then, re-factor the original tests that exercises
By
Angel Java Lopez
·
#35114
·
|
How do you go about splitting a class using TDD?
Hi all, I feel pretty skilled in TDD, and I'm even consired the "TDD expert" in my company, but nevertheless, there are some cases that I feel I don't know how to handle properly, so I would like to
By
arnonaxelrod
·
#35113
·
|
Request to participate in a research study regarding the performance appraisal of software testers.
Dear Members, ? I¡¯m a PhD student in Faculty of Information and Communication Technologies, Swinburne University of Technology. As a project of my PhD thesis, my supervisorsProfessor John Grundy
By
Tanjila Kanij
·
#35112
·
|
Re: [TDD] a Vehicule_ForTests subclass for the Vehicule class ?
I'm off. I'll check for further answers tomorrow. Thanks a lot =)
By
pierre masci <piemas25@...>
·
#35111
·
|
Re: [TDD] a Vehicule_ForTests subclass for the Vehicule class ?
Smart ! I thought that Test::Class was mostly used to inherits unit-tests from a class into its subclasses. And overload some of them when needed. But you're right, it could also enable to subclass
By
pierre masci <piemas25@...>
·
#35110
·
|
Re: [TDD] a Vehicule_ForTests subclass for the Vehicule class ?
Hi Ron, my message of 6:30pm (in england - it was 14 minutes before your message) answers this question with a simple example. My aim is simply to put bits of tests into a function, to avoid
By
pierre masci <piemas25@...>
·
#35109
·
|
Re: [TDD] a Vehicule_ForTests subclass for the Vehicule class ?
Or, a non-OO alternative would be to put played_with in a module of its own and call it from each different test module. That might be simpler to start, but you should still check out Test:Class,
By
Adam Sroka
·
#35108
·
|
Re: [TDD] a Vehicule_ForTests subclass for the Vehicule class ?
You can subclass your tests. Nothing wrong with that. Check this out: http://search.cpan.org/~adie/Test-Class-0.37/lib/Test/Class.pm
By
Adam Sroka
·
#35107
·
|
Re: [TDD] a Vehicule_ForTests subclass for the Vehicule class ?
Why do you have these sugar methods? What do they do? Why can't you test the Vehicle directly? R Ron Jeffries www.XProgramming.com Impossible is not a fact. It is an opinion. -- Muhammad Ali
By
Ron Jeffries
·
#35106
·
|
Re: [TDD] a Vehicule_ForTests subclass for the Vehicule class ?
Nope, i don't want to know about bits inside of $game. I'm just trying to avoid to have to copy-paste played_with() in each test file. Maybe i should just have a package in my unit-test folder, where
By
pierre masci <piemas25@...>
·
#35105
·
|
Re: [TDD] a Vehicule_ForTests subclass for the Vehicule class ?
P.S. the ONLY reason I would put played_with in a subclass of $game is if it needed to know about private bits inside of $game. However, actually hiding members in Perl 5 turns out to be nearly
By
Adam Sroka
·
#35104
·
|
Re: [TDD] a Vehicule_ForTests subclass for the Vehicule class ?
My perl is a tad rusty, but I would recommend you just keep the played_with() sub in the test. The only difference is you'd have to call it differently: played_with($game, @rolls); Subclassing $game
By
Adam Sroka
·
#35103
·
|
Re: [TDD] a Vehicule_ForTests subclass for the Vehicule class ?
For the first case (without assertion), i could put the played_with() method in an instance (a role, in Perl). If i left it in the test file, that would become a problem as soon as i will have several
By
pierre masci <piemas25@...>
·
#35102
·
|
Re: [TDD] a Vehicule_ForTests subclass for the Vehicule class ?
I'm learning Perl and TDD. I'm thinking both about methods that will "run a fairly similar part of several test cases", and about methods who will be tests by themself : they will contain assertions.
By
pierre masci <piemas25@...>
·
#35101
·
|