2014-12-04 119 views
-1

Testng本身起作用,可以生成結果。我試圖使用XSLT報告來使事情更漂亮,但我沒有任何運氣。這裏是日食是怎麼設置:http://i.imgur.com/A6XRbKt.jpg在build.xml上運行ANT命令時出現錯誤

build.xml文件:

<?xml version="1.0" encoding="iso-8859-1"?> 
<!DOCTYPE project [ 
]> 

<project name="TestNG" default="usage" basedir="."> 

<!-- ========== Initialize Properties =================================== --> 
<property environment="env"/> 
<property name="ws.home" value="${basedir}"/> 
<property name="ws.jars" value="E:\Selenium Main\TestNG\lib"/> 
<property name="test.dest" value="${ws.home}/build"/> 
<property name="test.src" value="${ws.home}/src"/> 
     <property name="ng.result" value="test-output"/> 

<!--target name="start-selenium-server"> 
    <java jar="${ws.home}/lib/selenium-server.jar"/> 
</target--> 

<target name="setClassPath" unless="test.classpath"> 
    <path id="classpath_jars"> 
     <fileset dir="${ws.jars}" includes="*.jar"/> 
    </path> 
    <pathconvert pathsep=":" 
     property="test.classpath" 
     refid="classpath_jars"/> 
</target> 

<target name="init" depends="setClassPath"> 
    <tstamp> 
     <format property="start.time" pattern="MM/dd/yyyy hh:mm aa" /> 
    </tstamp> 
    <condition property="ANT" 
     value="${env.ANT_HOME}/bin/ant.bat" 
     else="${env.ANT_HOME}/bin/ant"> 
     <os family="windows" /> 
    </condition> 
    <taskdef name="testng" classpath="${test.classpath}" 
      classname="org.testng.TestNGAntTask" /> 

</target> 

<!-- all --> 
<target name="all"> 
</target> 

<!-- clean --> 
<target name="clean"> 
    <delete dir="${test.dest}"/> 
</target> 

<!-- compile --> 
<target name="compile" depends="init, clean" > 
       <delete includeemptydirs="true" quiet="true"> 
     <fileset dir="${test.dest}" includes="**/*"/> 
       </delete> 
    <echo message="making directory..."/> 
       <mkdir dir="${test.dest}"/> 
    <echo message="classpath------: ${test.classpath}"/> 
    <echo message="compiling..."/> 
    <javac 
     debug="true" 
     destdir="${test.dest}" 
     srcdir="${test.src}" 
     target="1.5" 
     classpath="${test.classpath}" 
    > 
    </javac> 
    </target> 

<!-- build --> 
<target name="build" depends="init"> 
</target> 

<!-- run --> 
<target name="run" depends="compile"> 
<testng classpath="${test.classpath}:${test.dest}" suitename="sivaprasad"> 
     <xmlfileset dir="${ws.home}" includes="testng.xml"/> 
    </testng> 
    <!-- 
    <testng classpath="${test.classpath}:${test.dest}" groups="fast"> 
     <classfileset dir="${test.dest}" includes="example1/*.class"/> 
    </testng> 
    --> 
</target> 

<target name="usage"> 
    <echo> 
     ant run will execute the test 
    </echo> 
</target> 

     <path id="test.c"> 
       <fileset dir="${ws.jars}" includes="*.jar"/> 
     </path> 

     <target name="makexsltreports"> 
       <mkdir dir="${ws.home}/XSLT_Reports/output"/> 

    <xslt in="${ng.result}/testng-results.xml" style="src/xslt/testng-results.xsl" 
        out="${ws.home}/XSLT_Reports/output/index.html"     classpathref="test.c" processor="SaxonLiaison"> 
        <param name="testNgXslt.outputDir" expression="${ws.home}/XSLT_Reports/output/"/> 
    <param name="testNgXslt.showRuntimeTotals" expression="true"/> 
       </xslt> 
      </target> 

<!-- ****************** targets not used ****************** --> 
</project> 

錯誤消息: E:\硒主要\ TestNG的>螞蟻makexsltreports 構建文件:E:\硒主要\ TestNG的\的build.xml

makexsltreports: [XSLT]處理E:\硒主\ TestNG的\測試輸出\ TestNG的-results.xml到E:\硒主\ TestNG的\ XSLT_Reports \輸出\索引。 HTML [xslt]加載樣式表E:\ Selenium Main \ TestNG \ src \ xslt \ testng-results.xsl [xslt] E:\ Selenium Main \ TestNG \ src \ xslt \ testng-results.xsl:34:71:致命錯誤! XML解析器報告的錯誤原因:org.xml.sax.SAXParseException; systemId:file:/ E:/Selenium%20Main/TestNG/src/xslt/testng-results.xsl; lineNumber:34; columnNumber :71;與元素類型「meta」關聯的屬性名稱「data-pjax-transient」後面必須跟着'='字符。 [xslt]:致命錯誤! org.xml.sax.SAXParseException; systemId:file:/ E:/Selenium%20Main/TestNG/src/xslt/testng-results.xsl; lineNumber:34; columnNumber:71;與元素類型「meta」關聯的屬性名稱「data-pjax-transient」必須由'='字符降低。原因:org.xml.sax.SAXParseException; systemId:file:/ E:/Selenium%20Main/TestNG/src/xslt/testng-results.xsl; lineNumber:34; columnNumber:71;與元素類型「meta」關聯的屬性名稱「data-pjax-transient」其後跟隨'='字符。 [XSLT]未能處理E:使用變換期間致命錯誤:\硒主\ TestNG的\測試輸出\ TestNG的-results.xml

BUILD FAILED E:\硒主\ TestNG的\的build.xml:100 E:\ Selenium Main \ TestNG \ src \ xslt \ testng-results.xsl:org.xml.sax.SAXParseException; systemId:file:/ E:/Selenium%20Main/TestNG/src/xslt/testng-results.xsl; lineNumber:34; columnNumber:71;與元素類型「meta」關聯的屬性名稱「data-pjax-transient」後面必須跟着'='字符。

總時間:1秒

E:\硒主要\ TestNG的>

謝謝

回答

0

好吧,我固定的問題。 testng-results.xsl是它看起來像的問題。我用在互聯網上找到的另一個副本替換了該文件,現在它可以工作!

相關問題