Is there any way we can generate salesforce unittests html report using ANT migration tool?
Refering: https://github.com/beamso/force-deploy-with-xml-report-task
I tried appending junitreportdir to testLevel="RunLocalTests" but getting unsupported error as below:
**[root@ip-10-1-1-15 unit_test]# ant ValidateRunAllTestsReport
Buildfile: /opt/salesforce/ANT_Migration_Tool/unit_test/build.xml ValidateRunAllTestsReport: BUILD FAILED /opt/salesforce/ANT_Migration_Tool/unit_test/build.xml:33: sf:deploy doesn't support the "junitreportdir" attribute Total time: 2 seconds**
Below is my complete build.xml
<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">
<property file="build.properties"/>
<property environment="env"/>
<!-- Setting default value for username, password and session id properties to empty string
so unset values are treated as empty. Without this, ant expressions such as ${sf.username}
will be treated literally.
-->
<condition property="sf.username" value=""> <not> <isset property="sf.username"/> </not> </condition>
<condition property="sf.password" value=""> <not> <isset property="sf.password"/> </not> </condition>
<condition property="sf.sessionId" value=""> <not> <isset property="sf.sessionId"/> </not> </condition>
<taskdef resource="com/salesforce/antlib.xml" uri="antlib:com.salesforce">
<classpath>
<pathelement location="../ant-salesforce.jar" />
</classpath>
</taskdef>
<!-- Shows check only; never actually saves to the server -->
<target name="ValidateRunAllTests">
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" maxPoll="${sf.maxPoll}" deployRoot="${sf.srcFolder}" checkOnly="true" testLevel="RunLocalTests"/>
</target>
<path id="ant.additions.classpath">
<fileset dir="/opt/salesforce/ANT/apache-ant-1.10.7"/>
</path>
<target name="ValidateRunAllTestsReport">
<taskdef
name="sfdeploy"
classname="com.salesforce.ant.DeployWithXmlReportTask"
classpathref="ant.additions.classpath"
/>
<delete dir="test-report-xml" quiet="true"/>
<sf:deploy username="${sf.username}" password="${sf.password}" serverurl="${sf.serverurl}" maxPoll="${sf.maxPoll}" deployRoot="${sf.srcFolder}" checkOnly="true" testLevel="RunLocalTests" junitreportdir="test-report-xml"/>
</target>
I have this working in my env