You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Daniel Tabuenca <dt...@gmail.com> on 2007/05/25 09:58:27 UTC

Using BaseComponentTestCase in Junit

Without getting into a testng vs junit debate, I find the
BaseComponentTestCase class in tapestry-test very useful. However, in
the project I am working on we are using junit. It would be great if
this class could be used as a helper class without needing to extend
it, yet all the useful methods are listed as protected so I can't do
that. Can anyone offer me suggestions on how I could use the
functionality in BaseComponentTestCase without having to extend that
classs? Is there a compelling reason why those methods aren't just
made public?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Using BaseComponentTestCase in Junit

Posted by Daniel Tabuenca <dt...@gmail.com>.
I took a look at the code, ironically the TestBase which I'm using and
has all the methods public is the one depending on @AfterMethod
invocation. Of course I can just call cleanUpControlSource() in my
tearDown() method in junit and achieve the same thing. Sure I can do
what Patrick said and copy the code, but I think it would be most
useful to everyone if the methods in BaseComponentTest are made public
seeing that all the methods in BaseTest already are and put a not in
the documentation about calling cleanUpControlSource if using it as a
utility class.

On 5/26/07, Patrick Moore <pa...@amplafi.com> wrote:
> Why not just copy to code and do whatever conversion you need to do...
> probably simplest in the long run ??
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Using BaseComponentTestCase in Junit

Posted by Patrick Moore <pa...@amplafi.com>.
Why not just copy to code and do whatever conversion you need to do...
probably simplest in the long run ??

Re: Using BaseComponentTestCase in Junit

Posted by Daniel Tabuenca <dt...@gmail.com>.
All you'd need to do is expose have some method I can call
before/after, and I could do it manually. I'm using TestBase right now
because it exposes public methods (at least for the vital
newInstance() support). In the end JUnit and TestNG don't differ that
much. All the differences really boil down to at the code level is the
syntax for how to specify what runs first and what gets run. The logic
behind any test helper utility like tapestry-test can and should be
easily abstractable so it does not depend on any specific testing
framework.

On 5/25/07, Jesse Kuhnert <jk...@gmail.com> wrote:
> Yes for reasons like this . :)
>
> I would be ok with supporting junit (somehow) but don't know how the
> EasyMock parts are supposed to get handled there as the top level base class
> (which isn't BaseComponentTestCase) relies on @BeforeMethod / @AfterMethod
> annotations to do before/after cleanup calls.
>
> Either way I could certainly make a lot of the base methods static on some
> other class so that you can do static imports of them - they will just have
> to methods not relying on mock objects or state of any kind. (of which there
> are few)
>
> On 5/25/07, Daniel Tabuenca <dt...@gmail.com> wrote:
> >
> > Without getting into a testng vs junit debate, I find the
> > BaseComponentTestCase class in tapestry-test very useful. However, in
> > the project I am working on we are using junit. It would be great if
> > this class could be used as a helper class without needing to extend
> > it, yet all the useful methods are listed as protected so I can't do
> > that. Can anyone offer me suggestions on how I could use the
> > functionality in BaseComponentTestCase without having to extend that
> > classs? Is there a compelling reason why those methods aren't just
> > made public?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Using BaseComponentTestCase in Junit

Posted by Jesse Kuhnert <jk...@gmail.com>.
Yes for reasons like this . :)

I would be ok with supporting junit (somehow) but don't know how the
EasyMock parts are supposed to get handled there as the top level base class
(which isn't BaseComponentTestCase) relies on @BeforeMethod / @AfterMethod
annotations to do before/after cleanup calls.

Either way I could certainly make a lot of the base methods static on some
other class so that you can do static imports of them - they will just have
to methods not relying on mock objects or state of any kind. (of which there
are few)

On 5/25/07, Daniel Tabuenca <dt...@gmail.com> wrote:
>
> Without getting into a testng vs junit debate, I find the
> BaseComponentTestCase class in tapestry-test very useful. However, in
> the project I am working on we are using junit. It would be great if
> this class could be used as a helper class without needing to extend
> it, yet all the useful methods are listed as protected so I can't do
> that. Can anyone offer me suggestions on how I could use the
> functionality in BaseComponentTestCase without having to extend that
> classs? Is there a compelling reason why those methods aren't just
> made public?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com