[英]getting error in Ant build junitreporting
當我嘗試不使用junitreport
進行構建時,它的工作正常。 但是,我最終需要html格式的junit報告以及所有成功或失敗的腳本。 請建議我要去哪里錯了。 任何幫助,將不勝感激。
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="JavaP">
<property environment="env"/>
<property name="junit.output.dir" value="junit"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="JavaP.classpath">
<pathelement location="bin"/>
<pathelement location="../../Sel JAR/junit-4.8.1.jar"/>
<pathelement location="../../Sel JAR/jxl.jar"/>
<pathelement location="../../Sel JAR/poi-3.7.jar"/>
<pathelement location="../../Sel JAR/reportng-1.1.3.jar"/>
<pathelement location="../../Sel JAR/selenium-java-2.29.0.jar"/>
<pathelement location="../../Sel JAR/selenium-server-2.29.0.jar"/>
<pathelement location="../../Sel JAR/selenium-server-standalone-2.29.0.jar"/>
<pathelement location="../../Sel JAR/testng-6.5.2.jar"/>
</path>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="bin"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}" includeantruntime="false">
<src path="src"/>
<classpath refid="JavaP.classpath"/>
</javac>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
<target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler">
<copy todir="${ant.library.dir}">
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</copy>
<unzip dest="${ant.library.dir}">
<patternset includes="jdtCompilerAdapter.jar"/>
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</unzip>
</target>
<target description="compile project with Eclipse compiler" name="build-eclipse-compiler">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<antcall target="build"/>
</target>
<target name="JavaP">
<mkdir dir="${junit.output.dir}"/>
<junit fork="yes" printsummary="withOutAndErr">
<formatter type="xml"/>
<test name="seleniumtest.Helloworld" todir="${junit.output.dir}"/>
<test name="seleniumtest.Testclass" todir="${junit.output.dir}"/>
<classpath refid="JavaP.classpath"/>
</junit>
</target>
<target name="junitreport">
<junitreport todir="${junit.output.dir}">
<fileset dir="${junit.output.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.output.dir}"/>
</junitreport>
</target>
</project>
錯誤詳情
Buildfile: D:\Seljava\JavaP\build.xml
build-subprojects:
init:
build-project:
[echo] JavaP: D:\Seljava\JavaP\build.xml
build:
junitreport:
[junitreport] Processing D:\Seljava\JavaP\junit\TESTS-TestSuites.xml to C:\Users\nitinl\AppData\Local\Temp\null1642041795
[junitreport] Loading stylesheet jar:file:/D:/Eclipse-Workspace/eclipse/plugins/org.apache.ant_1.8.2.v20120109-1030/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
[junitreport] : Error! The first argument to the non-static Java function 'replace' is not a valid object reference.
[junitreport] : Error! Could not compile stylesheet
[junitreport] : Fatal Error! Could not compile stylesheet Cause: Cannot convert data-type 'void' to 'reference'.
[junitreport] Failed to process D:\Seljava\JavaP\junit\TESTS-TestSuites.xml
BUILD FAILED
D:\Seljava\JavaP\build.xml:70: Errors while applying transformations: Fatal error during transformation
Total time: 450 milliseconds
從Java 6升級到Java 7后,我也遇到了同樣的問題。我可以通過使用Ant 1.9.0在命令行上運行ant來解決此問題。
不幸的是,在Eclipse中運行Ant時,在Eclipse中切換到Ant 1.9.0(按照以下說明: 如何升級內置在eclipse中的ant? )無法解決問題,但是在命令行上運行是可行的,因此我正在使用。
我在使用螞蟻1.8.4和Java 5或6的eclipse kepler中運行時遇到相同的問題。
它可以從命令行ant 1.7.0與Java 5或6一起工作。
這是螞蟻內部的問題...
您可以通過從ant主頁下載兩個jar來解決此問題:org.apache.xalan org.apache.xml.serializer
在我的情況下,將這些文件放在C:\\ Windows \\ Sun \\ Java \\ lib \\ ext下,如果是這種情況,則只需創建它們就不會存在lib和ext文件夾。 重新啟動蝕,一切都會正常。 (這對我來說確實如此,在兩台PC上,而且在我學科上的很多隊友確實遇到了相同的問題,並且該解決方案對所有人都有效)
問候
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.