setUp and test methods

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

setUp and test methods

abergel
Hi!

I know there are many TDD shoguns around.

I was wondering whether I am the only one suffering from the need to see the definition of setUp before writing a test method. Unfortunately, current tool does not automatically show the definition of setUp when I want to write a new test.
The cost of seeing how the setUp is done is high: need to open a new window, clicking to restore the context on the first window, ...

Am I the only one?

Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






Reply | Threaded
Open this post in threaded view
|

Re: setUp and test methods

Frank Shearar-3
On 19 August 2011 14:09, Alexandre Bergel <[hidden email]> wrote:
> Hi!
>
> I know there are many TDD shoguns around.
>
> I was wondering whether I am the only one suffering from the need to see the definition of setUp before writing a test method. Unfortunately, current tool does not automatically show the definition of setUp when I want to write a new test.
> The cost of seeing how the setUp is done is high: need to open a new window, clicking to restore the context on the first window, ...
>
> Am I the only one?

Nope, I suffer from this problem too. I've been thinking about a more
general problem, that of displaying multiple method definitions in the
same place/window/whatever.

It seems the solution is two-fold:
* write a widget that can display multiple methods in the same pane, and
* tell the system that you want to see certain methods together.

In the case of tests, you could always use reflection - you're viewing
a method starting with "test" in a TestCase subclass, so if there's a
setUp method (or series of setUp methods, in the case of overriden
methods), display them together.

frank

Reply | Threaded
Open this post in threaded view
|

Re: setUp and test methods

abergel
Having the setUp next to the definition of a test is in my opinion the way to go (subliminal message for Ben :-)

Alexandre


On 19 Aug 2011, at 15:14, Frank Shearar wrote:

> On 19 August 2011 14:09, Alexandre Bergel <[hidden email]> wrote:
>> Hi!
>>
>> I know there are many TDD shoguns around.
>>
>> I was wondering whether I am the only one suffering from the need to see the definition of setUp before writing a test method. Unfortunately, current tool does not automatically show the definition of setUp when I want to write a new test.
>> The cost of seeing how the setUp is done is high: need to open a new window, clicking to restore the context on the first window, ...
>>
>> Am I the only one?
>
> Nope, I suffer from this problem too. I've been thinking about a more
> general problem, that of displaying multiple method definitions in the
> same place/window/whatever.
>
> It seems the solution is two-fold:
> * write a widget that can display multiple methods in the same pane, and
> * tell the system that you want to see certain methods together.
>
> In the case of tests, you could always use reflection - you're viewing
> a method starting with "test" in a TestCase subclass, so if there's a
> setUp method (or series of setUp methods, in the case of overriden
> methods), display them together.
>
> frank
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






Reply | Threaded
Open this post in threaded view
|

Re: setUp and test methods

laurent laffont
In reply to this post by abergel
On Fri, Aug 19, 2011 at 3:09 PM, Alexandre Bergel <[hidden email]> wrote:
Hi!

I know there are many TDD shoguns around.

I was wondering whether I am the only one suffering from the need to see the definition of setUp before writing a test method. Unfortunately, current tool does not automatically show the definition of setUp when I want to write a new test.
The cost of seeing how the setUp is done is high: need to open a new window, clicking to restore the context on the first window, ...

Am I the only one?


No. I would like too.

But not only for tests. I often need to look at several related methods at once while developing. 

Laurent.

 

Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.







Reply | Threaded
Open this post in threaded view
|

Re: setUp and test methods

abergel
Before leading a revolution, we can maybe have this work for unit test first :-)

Actually, when I think about it, having not the setUp visible when writing tests make the setUp functionality mostly useless.

Cheers,
Alexandre


On 19 Aug 2011, at 15:19, laurent laffont wrote:

> On Fri, Aug 19, 2011 at 3:09 PM, Alexandre Bergel <[hidden email]> wrote:
> Hi!
>
> I know there are many TDD shoguns around.
>
> I was wondering whether I am the only one suffering from the need to see the definition of setUp before writing a test method. Unfortunately, current tool does not automatically show the definition of setUp when I want to write a new test.
> The cost of seeing how the setUp is done is high: need to open a new window, clicking to restore the context on the first window, ...
>
> Am I the only one?
>
>
> No. I would like too.
>
> But not only for tests. I often need to look at several related methods at once while developing.
>
> Laurent.
>
>  
>
> Cheers,
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
>
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






Reply | Threaded
Open this post in threaded view
|

Re: setUp and test methods

laurent laffont


On Fri, Aug 19, 2011 at 3:23 PM, Alexandre Bergel <[hidden email]> wrote:
Before leading a revolution, we can maybe have this work for unit test first :-)

Actually, when I think about it, having not the setUp visible when writing tests make the setUp functionality mostly useless.


Also, I usually write the setUp to remove duplication, so often after the second test method. A refactoring "extract to setUp" would be cool too.

Another point, when I have a hierarchy of TestCase I often feel I need a "merged setUp view" 

Laurent.

 

Cheers,
Alexandre


On 19 Aug 2011, at 15:19, laurent laffont wrote:

> On Fri, Aug 19, 2011 at 3:09 PM, Alexandre Bergel <[hidden email]> wrote:
> Hi!
>
> I know there are many TDD shoguns around.
>
> I was wondering whether I am the only one suffering from the need to see the definition of setUp before writing a test method. Unfortunately, current tool does not automatically show the definition of setUp when I want to write a new test.
> The cost of seeing how the setUp is done is high: need to open a new window, clicking to restore the context on the first window, ...
>
> Am I the only one?
>
>
> No. I would like too.
>
> But not only for tests. I often need to look at several related methods at once while developing.
>
> Laurent.
>
>
>
> Cheers,
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
>
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.







Reply | Threaded
Open this post in threaded view
|

Re: setUp and test methods

abergel
Indeed, refactorings for unit tests are completely absent from the software engineering community.

Alexandre


On 19 Aug 2011, at 15:39, laurent laffont wrote:

>
>
> On Fri, Aug 19, 2011 at 3:23 PM, Alexandre Bergel <[hidden email]> wrote:
> Before leading a revolution, we can maybe have this work for unit test first :-)
>
> Actually, when I think about it, having not the setUp visible when writing tests make the setUp functionality mostly useless.
>
>
> Also, I usually write the setUp to remove duplication, so often after the second test method. A refactoring "extract to setUp" would be cool too.
>
> Another point, when I have a hierarchy of TestCase I often feel I need a "merged setUp view"
>
> Laurent.
>
>  
>
> Cheers,
> Alexandre
>
>
> On 19 Aug 2011, at 15:19, laurent laffont wrote:
>
> > On Fri, Aug 19, 2011 at 3:09 PM, Alexandre Bergel <[hidden email]> wrote:
> > Hi!
> >
> > I know there are many TDD shoguns around.
> >
> > I was wondering whether I am the only one suffering from the need to see the definition of setUp before writing a test method. Unfortunately, current tool does not automatically show the definition of setUp when I want to write a new test.
> > The cost of seeing how the setUp is done is high: need to open a new window, clicking to restore the context on the first window, ...
> >
> > Am I the only one?
> >
> >
> > No. I would like too.
> >
> > But not only for tests. I often need to look at several related methods at once while developing.
> >
> > Laurent.
> >
> >
> >
> > Cheers,
> > Alexandre
> > --
> > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> > Alexandre Bergel  http://www.bergel.eu
> > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
> >
> >
> >
> >
> >
> >
> >
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
>
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






Reply | Threaded
Open this post in threaded view
|

Re: setUp and test methods

laurent laffont
On Fri, Aug 19, 2011 at 3:41 PM, Alexandre Bergel <[hidden email]> wrote:
Indeed, refactorings for unit tests are completely absent from the software engineering community.


Oh, so you just have to invent it :)

Laurent.

 

Alexandre


On 19 Aug 2011, at 15:39, laurent laffont wrote:

>
>
> On Fri, Aug 19, 2011 at 3:23 PM, Alexandre Bergel <[hidden email]> wrote:
> Before leading a revolution, we can maybe have this work for unit test first :-)
>
> Actually, when I think about it, having not the setUp visible when writing tests make the setUp functionality mostly useless.
>
>
> Also, I usually write the setUp to remove duplication, so often after the second test method. A refactoring "extract to setUp" would be cool too.
>
> Another point, when I have a hierarchy of TestCase I often feel I need a "merged setUp view"
>
> Laurent.
>
>
>
> Cheers,
> Alexandre
>
>
> On 19 Aug 2011, at 15:19, laurent laffont wrote:
>
> > On Fri, Aug 19, 2011 at 3:09 PM, Alexandre Bergel <[hidden email]> wrote:
> > Hi!
> >
> > I know there are many TDD shoguns around.
> >
> > I was wondering whether I am the only one suffering from the need to see the definition of setUp before writing a test method. Unfortunately, current tool does not automatically show the definition of setUp when I want to write a new test.
> > The cost of seeing how the setUp is done is high: need to open a new window, clicking to restore the context on the first window, ...
> >
> > Am I the only one?
> >
> >
> > No. I would like too.
> >
> > But not only for tests. I often need to look at several related methods at once while developing.
> >
> > Laurent.
> >
> >
> >
> > Cheers,
> > Alexandre
> > --
> > _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> > Alexandre Bergel  http://www.bergel.eu
> > ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
> >
> >
> >
> >
> >
> >
> >
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
>
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.







Reply | Threaded
Open this post in threaded view
|

Re: setUp and test methods

Stéphane Ducasse
In reply to this post by Frank Shearar-3
Yes I would like to have a bit the same than in wiskher browser and see multiple method definitino
In O2 there was such possibility but only vertically (you could pin a method pane when you did not want its method to get replace by another one).

Stef

On Aug 19, 2011, at 3:14 PM, Frank Shearar wrote:

> On 19 August 2011 14:09, Alexandre Bergel <[hidden email]> wrote:
>> Hi!
>>
>> I know there are many TDD shoguns around.
>>
>> I was wondering whether I am the only one suffering from the need to see the definition of setUp before writing a test method. Unfortunately, current tool does not automatically show the definition of setUp when I want to write a new test.
>> The cost of seeing how the setUp is done is high: need to open a new window, clicking to restore the context on the first window, ...
>>
>> Am I the only one?
>
> Nope, I suffer from this problem too. I've been thinking about a more
> general problem, that of displaying multiple method definitions in the
> same place/window/whatever.
>
> It seems the solution is two-fold:
> * write a widget that can display multiple methods in the same pane, and
> * tell the system that you want to see certain methods together.
>
> In the case of tests, you could always use reflection - you're viewing
> a method starting with "test" in a TestCase subclass, so if there's a
> setUp method (or series of setUp methods, in the case of overriden
> methods), display them together.
>
> frank
>


Reply | Threaded
Open this post in threaded view
|

Re: setUp and test methods

Sean P. DeNigris
Administrator
In reply to this post by abergel
Alexandre Bergel-7 wrote
Indeed, refactorings for unit tests are completely absent from the software engineering community.
I purposely often don't refactor my tests much because I find highly-refactored tests impossible to understand with the standard browsers. I've seen projects where the set up and assertions are spread over multiple classes! Now I have to start chasing things through the implementors browser at the same time as looking at the test to figure out what's going on.

Reinvented testing tools would be awesome (if you haven't tried Laurent's Autotest yet, it's a joy). I've been working on some test-specific tools that capture the domain better. I'd be glad to talk about it - just flag me down at ESUG. Although, if I understand Ring, I think the really magic will happen once it's ready and we can operate on the AST.

Sean
Cheers,
Sean