when I run java test file(single file) through eclipse by passing arguments
-DappRoot=ECM -DappName=ESW -Dapp.module=FNT -Dapp.env=LOC -DcloneNumber=1
test file executes without error, if I dont give arguments error occurs as Could not resolve placeholder ‘appRoot’.
I have junit target to generate report in html format.
<target name="junit" depends="init-junit">
<junit printsummary="on" fork="yes" forkmode="perBatch" haltonfailure="false" failureproperty="junit.failure" showoutput="false">
<classpath>
<path refid="CLASSPATH_JUNIT"/>
</classpath>
<batchtest fork="no" todir="${TEST_BUILD_DIR}">
<fileset dir="${COMP_TEST_SRC}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
<formatter type="xml" />
</junit>
<junitreport todir="${JUNIT_REPORT}">
<fileset dir="${TEST_BUILD_DIR}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${JUNIT_REPORT}"/>
</junitreport>
</target>
When I run above build script, getting following error: Could not resolve placeholder ‘appRoot’ where this has passed as an arguments.
I have passed parameter to build.xml through eclipse, this parameter passes to build.xml file but not passing to java files. How can I solve this?
EDIT:
tried with following parameter:
<junit printsummary="on" fork="yes" forkmode="perBatch" haltonfailure="false" failureproperty="junit.failure" showoutput="false">
<jvmarg value="-DappRoot=ECM" />
<jvmarg value="-DappName=ESW" />
<jvmarg value="-Dapp.module=FNT" />
<jvmarg value="-Dapp.env=LOC" />
<jvmarg value="-DcloneNumber=1" />
<!--<sysproperty key="appRoot" value="${appRoot}"/>
<sysproperty key="appName" value="${appName}"/>
<sysproperty key="app.module" value="${app.module}"/>
<sysproperty key="app.env" value="${app.env}"/>
<sysproperty key="cloneNumber" value="${cloneNumber}"/>-->
<classpath>
<path refid="CLASSPATH_JUNIT"/>
</classpath>
with system paramter it works fine but takes very long time to execute. with jvmarg it doesnt work. same error with
<jvmarg value="-DappRoot=${appRoot}" />
http://ant.apache.org/manual/Tasks/junit.html doesn’t define any restriction for sys and jvm args.
The documentation of the junit ant task shows it:
If the appRoot property is passed as a system property to ant, you may access it as an ant property: