You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by AJRobson <aj...@hotmail.com> on 2013/04/22 21:30:54 UTC

Possible to have list of systemProperties in an external file?

I have just started with Maven today so am still getting up to speed. I have
set up a selenium test in Eclipse, in my test I have baseUrl =
System.getProperty("webdriver.base.url");

I then run the test via command line passing in the argument I want the base
url to be

mvn clean test -Dwebdriver.base.url=http://www.google.com

My problem is that I am working on a test where I will need to pass in a lot
of arguments and would prefer if I could read them from a properties file
instead of having a massive command line argument.

Is this possible and can anyone point me to a tutorial so I can set this up?

I have read about the mojo properties maven plugin which I have added to my
pom.xml but I haven't been able to get it working so far.





--
View this message in context: http://maven.40175.n5.nabble.com/Possible-to-have-list-of-systemProperties-in-an-external-file-tp5754193.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Possible to have list of systemProperties in an external file?

Posted by Andreas Gudian <an...@gmail.com>.
Hi,

You can use the systemPropertyValues config element of the surefire plugin:

http://maven.apache.org/surefire/maven-surefire-plugin/examples/system-properties.html

Cheers,
Andreas

Am Dienstag, 23. April 2013 schrieb Wayne Fay :

> > My problem is that I am working on a test where I will need to pass in a
> lot
> > of arguments and would prefer if I could read them from a properties file
> > instead of having a massive command line argument.
>
> Seems smarter (to me) to adjust your test code to read from a
> properties file or similar than expect Maven to pass a bunch of system
> properties to it.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org <javascript:;>
> For additional commands, e-mail: users-help@maven.apache.org<javascript:;>
>
>

Re: Possible to have list of systemProperties in an external file?

Posted by Stephen Connolly <st...@gmail.com>.
Pass the path to the properties file as a system property and have the
tests use Assume.assumeThat to skip if the property is not defined.

Use the Surefire systemPropertyVariables to pass the property through to
the tests

On Tuesday, 23 April 2013, AJRobson wrote:

> Hi Wayne,
>
> Thank you for the reply. Unfortunately I am not sure I could do it that was
> as I will be running a set of tests on different sites so I need to pass in
> a properties files that will contain login information, DB information,
> product information etc.
>
>
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Possible-to-have-list-of-systemProperties-in-an-external-file-tp5754193p5754208.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org <javascript:;>
> For additional commands, e-mail: users-help@maven.apache.org<javascript:;>
>
>

-- 
Sent from my phone

Re: Possible to have list of systemProperties in an external file?

Posted by Wayne Fay <wa...@gmail.com>.
> Thank you for the reply. Unfortunately I am not sure I could do it that was
> as I will be running a set of tests on different sites so I need to pass in
> a properties files that will contain login information, DB information,
> product information etc.

I'd suggest you take this question to a JUnit or TestNG email list and
see how people there are solving these types of issues. I really think
reading the properties in your test(s) is the right approach, not
feeding them in via system properties.

Wayne

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


Re: Possible to have list of systemProperties in an external file?

Posted by AJRobson <aj...@hotmail.com>.
Hi Wayne,

Thank you for the reply. Unfortunately I am not sure I could do it that was
as I will be running a set of tests on different sites so I need to pass in
a properties files that will contain login information, DB information,
product information etc. 





--
View this message in context: http://maven.40175.n5.nabble.com/Possible-to-have-list-of-systemProperties-in-an-external-file-tp5754193p5754208.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: Possible to have list of systemProperties in an external file?

Posted by Wayne Fay <wa...@gmail.com>.
> My problem is that I am working on a test where I will need to pass in a lot
> of arguments and would prefer if I could read them from a properties file
> instead of having a massive command line argument.

Seems smarter (to me) to adjust your test code to read from a
properties file or similar than expect Maven to pass a bunch of system
properties to it.

Wayne

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