Salesforce ant 是否为 testLevel= "RunLocalTests" 生成 html 报告?



有什么方法可以使用ANT迁移工具生成salesforce unittests html报告吗?

参考:https://github.com/beamso/force-deploy-with-xml-report-task

我尝试将junistreportdir附加到testLevel="RunLocalTests",但得到了以下不受支持的错误:

**[root@ip-10-1-1-15unit_test]#ant ValidateRunAllTestsReport

生成文件:/opt/salesforce/ANT_Migration_Tool/unit_test/build.xml验证运行所有测试报告:生成失败/opt/salesforce/ANT_Migration_Tool/unit_test/build.xml:33:sf:deploy不支持"junistportdir"属性总时间:2秒**

以下是我的完整构建.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>   

我在我的env 中有这个工作

<target name="deployAndTestAndReport" depends="generic_build_tasks">
<taskdef
name="sfdeploy"
classname="com.salesforce.ant.DeployWithXmlReportTask"
classpath="lib/ant-salesforce.jar;lib/force-deploy-with-xml-report-task.jar"
/>
<delete dir="test-report-xml" quiet="true"/>
<sfdeploy
username="${sf_deploy_username}"
password="${sf_deploy_password}"
serverurl="${sf_deploy_url}"
deployRoot="src"
maxPoll="${sf.maxPoll}"
pollWaitMillis="${sf.pollWaitMillis}"
testLevel="RunLocalTests"
junitreportdir="test-report-xml"
checkOnly="true"
>
<!-- Run only tests with file names that match this pattern -->
<!--<batchtest>
<fileset dir="src/classes">
<include name="*Test.cls"/>
</fileset>
</batchtest>-->
</sfdeploy>
</target>

最新更新