You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Matt Benson <gu...@yahoo.com> on 2006/10/03 19:00:16 UTC
Re: [antunit] doco error WAS @Before/AfterClass analogues
The AntUnit documentation says:
"Each test target is run in a fresh Ant project; i.e.
each test target has a fresh set of properties and
references." But if I have test targets:
<target name="testFoo">
<property name="foo" value="foo" />
<au:assertTrue message="$${foo}=${foo}">
<equals arg1="${foo}" arg2="foo" />
</au:assertTrue>
</target>
<target name="testBar">
<property name="foo" value="bar" />
<au:assertTrue message="$${foo}=${foo}">
<equals arg1="${foo}" arg2="bar" />
</au:assertTrue>
</target>
one will fail, as I would expect given that the
AntUnit code uses a single Project instance to run all
targets.
The fun part: if we change the behavior to suit the
documentation, the utility of beforeTests/afterTests
is pretty much reduced to filesystem artifacts. I
would choose to correct the documentation to describe
the actual behavior, and see if we can't get scoped
properties working (minus the memory leaks) for Ant
1.7.1-1.8 , to alleviate the discomfort of having to
choose new properties for every test (see the apply
testcase in core).
Thoughts?
-Matt
--- Matt Benson <gu...@yahoo.com> wrote:
> JUnit 4 and TestNG have a Before/AfterClass concept
> for expensive setup/tearDown applicable to most or
> all
> of a test class. AntUnit needs something similar;
> e.g. before/after[File|Build|Resource|All]... I
> think
> it's useful to retain the before/after nomenclature
> for familiarity bred from JUnit 4 and TestNG use in
> the community. I will implement as
> before/AfterFile;
> if folk have issues we can discuss a better idiom.
>
> -Matt
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: [antunit] doco error WAS @Before/AfterClass analogues
Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 3 Oct 2006, Matt Benson <gu...@yahoo.com> wrote:
> The fun part: if we change the behavior to suit the
> documentation, the utility of beforeTests/afterTests
> is pretty much reduced to filesystem artifacts.
Or other expensive set up code like preparing a database or starting
an application server.
Setting up properties and references should be cheap enough for a
setUp target IMHO.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: [antunit] doco error WAS @Before/AfterClass analogues
Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 5 Oct 2006, Matt Benson <gu...@yahoo.com> wrote:
> You mention that properties, etc. are low-cost enough
> for setup; obviously so. My concern was actually for
> compilation of support classes (e.g. testing <java>);
> I would hate to keep compiling and blowing away a
> bunch of classes in each setUp/tearDown. Maybe we
> should use before/After[Tests as Peter suggested], and
> document that these should be limited to effects that
> live beyond the scope of the Project instance (i.e.
> FS, DB, etc.)?
I wasn't arguing against before/afterTests at all. You said yourself
that it should be used for bigger cost setup code and compiling would
certainly fit in.
As for naming, I do have a long history of giving bad advice, so I
kept silent. NUnit has Setup for the per test setup methods and
TestFixtureSetup for per class setup, same for teardown.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: [antunit] doco error WAS @Before/AfterClass analogues
Posted by Matt Benson <gu...@yahoo.com>.
--- Stefan Bodewig <bo...@apache.org> wrote:
> On Tue, 3 Oct 2006, Matt Benson
> <gu...@yahoo.com> wrote:
> > The AntUnit documentation says:
> >
> > "Each test target is run in a fresh Ant project;
> i.e.
> > each test target has a fresh set of properties and
> > references."
>
> I think it should better be the way the
> documentation says, even
> though it is currently implemented in a different
> way (because it was
> easier to do and I didn't think about it).
>
I'm not going to fight on this one; obviously there
are simple and valid reasons to use a new Project
instance.
You mention that properties, etc. are low-cost enough
for setup; obviously so. My concern was actually for
compilation of support classes (e.g. testing <java>);
I would hate to keep compiling and blowing away a
bunch of classes in each setUp/tearDown. Maybe we
should use before/After[Tests as Peter suggested], and
document that these should be limited to effects that
live beyond the scope of the Project instance (i.e.
FS, DB, etc.)?
-Matt
> Stefan
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: [antunit] doco error WAS @Before/AfterClass analogues
Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 3 Oct 2006, Matt Benson <gu...@yahoo.com> wrote:
> The AntUnit documentation says:
>
> "Each test target is run in a fresh Ant project; i.e.
> each test target has a fresh set of properties and
> references."
I think it should better be the way the documentation says, even
though it is currently implemented in a different way (because it was
easier to do and I didn't think about it).
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: [antunit] doco error WAS @Before/AfterClass analogues
Posted by Steve Loughran <st...@apache.org>.
Matt Benson wrote:
> The AntUnit documentation says:
>
> "Each test target is run in a fresh Ant project; i.e.
> each test target has a fresh set of properties and
> references." But if I have test targets:
>
> <target name="testFoo">
> <property name="foo" value="foo" />
> <au:assertTrue message="$${foo}=${foo}">
> <equals arg1="${foo}" arg2="foo" />
> </au:assertTrue>
> </target>
>
> <target name="testBar">
> <property name="foo" value="bar" />
> <au:assertTrue message="$${foo}=${foo}">
> <equals arg1="${foo}" arg2="bar" />
> </au:assertTrue>
> </target>
>
> one will fail, as I would expect given that the
> AntUnit code uses a single Project instance to run all
> targets.
>
> The fun part: if we change the behavior to suit the
> documentation, the utility of beforeTests/afterTests
> is pretty much reduced to filesystem artifacts. I
> would choose to correct the documentation to describe
> the actual behavior, and see if we can't get scoped
> properties working (minus the memory leaks) for Ant
> 1.7.1-1.8 , to alleviate the discomfort of having to
> choose new properties for every test (see the apply
> testcase in core).
>
> Thoughts?
Every test run should be in its own project.
if you want setup before a test, you can depend on setup targets, and we
already do a teardown at the end of each run
If you want before/after targets, why not modify <au:antunit> to let you
declare the name of the before/after targets to run?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org