How to expose a System property to a JUnit test from gradle

Hello,
I am trying to use a system property from a JUnit test:

System.getProperty("my.property");

In my gradle.properties have tried various combination of:

systemProp.microej.option.microej.java.property.my.property="value"
systemProp.microej.java.property.my.property="value"
systemProp.microej.option.my.property="value"
systemProp.my.property="value"

I tried the same from the build.gradle.kts (without the systemProp) but nothing worked.

What am I missing?

I use SDK6 1.4.0

Thanks

Hello @medhi.j ,

Properties injected to a test must be prefixed by microej.testsuite.properties, so in your case systemProp.microej.testsuite.properties.microej.java.property.my.property=”value” should work.

You can refer to this documentation for more information about Application options in a testsuite.

Regards,

Denis

1 Like