I do find it rather annoying that I have to explicitly pass system
properties over to the test task. That is, it is not enough to run gradle
test -Dfoo=bar I also have to tell the test task to use the system
properties I am passing in.


On Tue, Sep 27, 2011 at 2:08 PM, Kallin Nagelberg <
[email protected]> wrote:

> It turns out it's because I'm using a custom Test task, it doesn't inherit
> the main test configuration.
>
> I had something like:
> test {
>     systemProperties['db.username'] = 'bakala'
> }
> task myTest(type: Test) {
>     include ...
> }
>
> and I was running 'gradle myTest' which would ignored the settings.
>
> Thanks for looking!
> -Kal
>
>
>
> On Tue, Sep 27, 2011 at 1:19 PM, Kallin Nagelberg <
> [email protected]> wrote:
>
>> Hey,
>>
>> I've tried all manner of wizardry to pass a system property to my tests,
>> but no dice. I've tried things like
>>
>> test.allJvmArgs = (test.allJvmArgs <<
>> ['-XX:MaxPermSize=512M','-Ddb.username=bakala']).flatten()
>>
>> and
>>
>> test {
>>     systemProperties['db.username'] = 'bakala'
>>     jvmArgs '-Ddb.username=bakala'
>> }
>>
>>  and
>>
>> gradle -i myTest -Ddb.username=bakala
>>
>> In my test I have
>>
>> System.out.println(System.getProperty("db.username"));
>>
>> and it always comes out as null.
>>
>> Any help would be really appreciated!
>>
>> Thanks,
>> -Kallin Nagelberg
>>
>
>

Reply via email to