Setting properties for tests

View: New views
3 Messages — Rating Filter:   Alert me  

Setting properties for tests

by Russel Winder-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry if this is RTFM . . .

How can I set a property in the JVM of a forked unit test JVM?

Ant has the sysproperty task as part of the junit task which does the
needful, so the goal is easy in Gant and Ant.  I am guessing it is easy
in Gradle as well but . . .

BTW The user guide needs an example of setting test forkmode to once,
the text says what has to be done but not how to do it.  cf. Section
18.11, page 103.  The Gradle build appears to have a single instance of
the string forkmode, and it is not enlightening.
--
Russel.
=============================================================================
Dr Russel Winder      Partner
                                            xmpp: russel@...
Concertant LLP        t: +44 20 7585 2200, +44 20 7193 9203
41 Buckmaster Road,   f: +44 8700 516 084   voip: sip:russel.winder@...
London SW11 1EN, UK   m: +44 7770 465 077   skype: russel_winder


signature.asc (204 bytes) Download Attachment

Re: Setting properties for tests

by Adam Murdoch-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Russel Winder wrote:
> Sorry if this is RTFM . . .
>
> How can I set a property in the JVM of a forked unit test JVM?
>
> Ant has the sysproperty task as part of the junit task which does the
> needful, so the goal is easy in Gant and Ant.  I am guessing it is easy
> in Gradle as well but . . .
>
>  

There's an example in the java quickstart chapter:

http://gradle.org/0.8/docs/userguide/tutorial_java_projects.html#N10420

Not the most obvious place to find it, I know. Perhaps a tutorial
chapter on testing would be good. And certainly a task reference with
the options listed would be useful.

> BTW The user guide needs an example of setting test forkmode to once,
> the text says what has to be done but not how to do it.  cf. Section
> 18.11, page 103.  The Gradle build appears to have a single instance of
> the string forkmode, and it is not enlightening.
>  

Forkmode is once by default.

--
Adam Murdoch
Gradle Developer
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Setting properties for tests

by Russel Winder-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 2009-10-19 at 09:07 +1100, Adam Murdoch wrote:

>
> Russel Winder wrote:
> > Sorry if this is RTFM . . .
> >
> > How can I set a property in the JVM of a forked unit test JVM?
> >
> > Ant has the sysproperty task as part of the junit task which does the
> > needful, so the goal is easy in Gant and Ant.  I am guessing it is easy
> > in Gradle as well but . . .
> >
> >  
>
> There's an example in the java quickstart chapter:
>
> http://gradle.org/0.8/docs/userguide/tutorial_java_projects.html#N10420
Exactly the example needed to solve the problem, thanks.  As you say
this point needs more coverage in more places -- or at least more
references to this example.

I wonder if GRADLE-407 (http://jira.codehaus.org/browse/GRADLE-407)
needs updating?

> Not the most obvious place to find it, I know. Perhaps a tutorial
> chapter on testing would be good. And certainly a task reference with
> the options listed would be useful.

Agreed.

> > BTW The user guide needs an example of setting test forkmode to once,
> > the text says what has to be done but not how to do it.  cf. Section
> > 18.11, page 103.  The Gradle build appears to have a single instance of
> > the string forkmode, and it is not enlightening.
> >  
>
> Forkmode is once by default.

As far as I can tell the user guide specifies that it is per test.
Quoting from 18.11, p103:

"Per default the tests are run in a forked JVM and the fork is done per
test. You can modify this behavior by setting forking to false or set
the forkmode to once."

So now the question is how can the user set this to per test?

--
Russel.
=============================================================================
Dr Russel Winder      Partner
                                            xmpp: russel@...
Concertant LLP        t: +44 20 7585 2200, +44 20 7193 9203
41 Buckmaster Road,   f: +44 8700 516 084   voip: sip:russel.winder@...
London SW11 1EN, UK   m: +44 7770 465 077   skype: russel_winder


signature.asc (204 bytes) Download Attachment