首页 > 解决方案 > 使用 Jenkins 进行 Ant SOA 测试

问题描述

我正在尝试通过 Jenkins 中的 Ant 脚本测试 SOA。我可以在我的 PC 中运行 ant 脚本的测试,但是当我尝试在 Jenkins 作业中创建相同的脚本时它失败了。当我使用 Ant 脚本直接在 PC 中运行时,相同的命令运行良好。用于部署的 Ant 命令运行良好,但 ant 测试给了我挑战。

下面的命令

ant -f ant-sca-test.xml -Dscatest.input=TestSOAAdd -Djndi.properties.input=D:/12c_Ant/ant_soa/jndi.properties

下面是错误信息。

No changes for http://code.sunpowercorp.com/middleware-repo/fmw_12c/code/trunk/TestSOAAdd since the previous build
[ant_soa] $ cmd.exe /C "D:\Jdev1221\Middleware\Oracle_Home\oracle_common\modules\org.apache.ant_1.9.2\bin\ant.bat -file ant-sca-test.xml -DCompositeName=TestSOAAdd -DSVNCodePath=TestSOAAdd -Dtargetenv=proj ant-sca-test.xml -Dscatest.input=TestSOAAdd -Djndi.properties.input=D:\12c_Ant\ant_soa\jndi.properties && exit %%ERRORLEVEL%%"
Buildfile: D:\12c_Ant\ant_soa\ant-sca-test.xml
     [echo] Running scatest using oracle.home = D:\Jdev1221\Middleware\Oracle_Home
BUILD FAILED
Target "ant-sca-test.xml" does not exist in the project "ant-scactest". 

蚂蚁测试文件如下:

<?xml version="1.0" encoding="iso-8859-1" ?>
<project name="ant-scactest" default="test">
  <!--  must have these properties available 
  -->
  <!-- oracle.home -->
  <condition property="oracle.home" value="D:\Oracle\Middleware\Oracle_Home">
    <not><isset property="oracle.home"/></not>
  </condition>
  <fail message="oracle.home is not available. Please provide this property.">
    <condition>
      <not>
        <isset property="oracle.home"/>
      </not>
    </condition>
  </fail>

  <import file="ant-soa-common.xml"/>

  <property environment="env"/>
  <fail message="JAVA_HOME is not available. Please provide this property.">
    <condition>
      <and>
        <not>
          <isset property="env.JAVA_HOME"/>
        </not>
        <not>
          <isset property="java.passed.home"/>
        </not>
      </and>
    </condition>
  </fail>
  <condition property="java.passed.home" value="${env.JAVA_HOME}">
    <isset property="env.JAVA_HOME"/>
  </condition>
  <condition property="scatest.format" value="native">
    <not>
      <isset property="scatest.format"/>
    </not>
  </condition>
  <condition property="scatest.result" value="${java.io.tmpdir}/out">
    <not>
      <isset property="scatest.result"/>
    </not>
  </condition>
  <condition property="scatest.timeout" value="300">
    <not>
      <isset property="scatest.timeout"/>
    </not>
  </condition>
  <property name="scatest.partition" value="default"/>
  <!-- if wl_home is not provided use the default -->
  <condition property="wl_home" value="${mw.home}/wlserver">
    <not>
      <isset property="wl_home"/>
    </not>
  </condition>

  <!--  jars needed to run scatest ant task -->
  <path id="scatest.tasks.class.path">
    <fileset dir="${mw.home}/soa/soa/modules/oracle.soa.fabric_11.1.1">
      <include name="fabric-runtime.jar"/>
      <include name="fabric-ext.jar"/>      <include name="oracle-soa-client-api.jar"/>
    </fileset>
    <fileset dir="${oracle.soa.mgmt.home}/soa/modules/oracle.soa.mgmt_11.1.1">
      <include name="soa-infra-mgmt.jar"/>
    </fileset>
    <fileset dir="${mw.home}/soa/soa/modules/oracle.soa.bpel_11.1.1">
      <include name="orabpel.jar"/>
      <include name="orabpel-common.jar"/>
    </fileset>
    <pathelement location="${wl_home}/server/lib/weblogic.jar" />
    <pathelement location="${wl_home}/server/lib/wlclient.jar" />
    <fileset dir="${common.components.home}/modules">
      <include name="oracle.jps/jps-api.jar"/>
      <include name="oracle.jps/jps-internal.jar"/>
      <include name="oracle.jps/jps-common.jar"/>
      <include name="oracle.jrf/jrf-api.jar"/>
    </fileset>
    <!-- was specific files -->
    <pathelement location="${oracle.soa.mgmt.home}/soa/modules/oracle.soa.mgmt_11.1.1/soa-client-stubs-was.jar"/>
    <pathelement location="${was.home}/runtimes/com.ibm.ws.ejb.thinclient_8.0.0.jar"/>
    <pathelement location="${was.home}/runtimes/com.ibm.ws.orb_8.0.0.jar"/>
    <pathelement location="${was.home}/plugins/com.ibm.ws.runtime.jar"/>
    <pathelement location="${was.home}/runtimes/com.ibm.ws.admin.client_8.0.0.jar"/>
    <!--
    <pathelement location="${was.home}/runtimes/com.ibm.ws.webservices.thinclient_8.0.0.jar"/>
    -->
    <!-- end was specific files -->
  </path>
  <property name="scatest.tasks.class.path" refid="scatest.tasks.class.path"/>
  <echo message="Running scatest using oracle.home = ${oracle.home} "></echo>
  <taskdef name="scatest"
    classname="oracle.integration.platform.testfwk.ant.ScaTestTask">
    <classpath>
      <pathelement path="${scatest.tasks.class.path}"/>
    </classpath>
  </taskdef>
  <target name="test" description="Run a composite test">
    <echo message="Classpth = ${scatest.tasks.class.path}"/>
    <echo message="Running scatest using oracle.home = ${oracle.home} ${scatest.input}"></echo>
    <echo message="Using context = build.properties"></echo>
    <echo message="Using path = ${scatest.tasks.class.path}"></echo>
    <input message="Please enter composite name to test:"
      addproperty="scatest.input"/>
    <input message="Please enter the path to the jndi properties:"
      addproperty="jndi.properties.input"/>
    <scatest compositedn="${scatest.partition}/${scatest.input}" timeout="${scatest.timeout}"
      xsl="${scatest.format}" runname="antRun-TestFwk"
      resultsdir="${scatest.result}"
      context="${jndi.properties.input}">
      <!-- provide , separated list of suite names, defaults to all suites
      <suite name="${scatestsuite.input}"/>
      -->
    </scatest>
  </target>
  <target name="report" description="Generate junit report for a composite test" >
    <echo message="Generate report to ${scatest.result}"/>
    <junitreport todir="${scatest.result}/xml">
      <fileset dir="${scatest.result}">
        <include name="BPEL-*.xml" />
      </fileset>
      <report format="frames" todir="${scatest.result}/html" />
    </junitreport>  
  </target>
</project>

我在这里做错了什么?

编辑:我已将命令更改为“测试”而不是 and-sca-test.xml 并且它有效

test -Dscatest.input=TestSOAAdd -Djndi.properties.input=D:/12c_Ant/ant_soa/jndi.properties

我在调用 junit 生成报告时遇到问题。无论我为“测试报告 XML”提供什么输入,它都会失败,没有匹配错误。

标签: testingjenkinsantsoa

解决方案


推荐阅读