在使用命令提示符/ hudson工具执行build.xml文件时出现此错误"错误:包jxl不存在"
我正在使用Testng + ant运行我现有的开发的selenium webdriver脚本,这些脚本位于混合+页面工厂框架中
当我在单个类中有脚本时,即在功能驱动的框架中,我能够生成testngXSLT报告。
下面是我的Build.xml文件。
<?xml version ="1.0" encoding="iso-8859-1"?>
<project name="BulkInvite" default="usage" basedir=".">
<!-- ========== Initialize Properties =================================== -->
<property environment="env"/>
<property name="ws.home" value="${basedir}"/>
<property name="ws.jars" value="D:\jar-files"/>
<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="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 -->
<!-- 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"
source="1.5"
includeantruntime="true"
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="Bulkinvite_Suite">
<xmlfileset dir="test-output" includes="BulkinviteExecute.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="generateReport" >
<mkdir dir="${ws.home}/XSLT_Reports/output">
</mkdir>
<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>
<!--using javax mailjar and javax activation jar trying to send report as zip file -->
<target name="sendMail" depends="generateReport">
<zip destfile="${ws.home}/XSLT_Reports/output.zip" basedir="${ws.home}/XSLT_Reports/output"/>
<mail
tolist="abc.adsf@asdf.com"
from="XXX@gmail.com"
subject="ANT_AUTO_Generated_EMAIL__Hurraih.."
mailhost="smtp.gmail.com"
mailport="XXX"
ssl="true"
user="XXXXX@gmail.com"
password="XXXX">
<attachments>
<fileset dir="${ws.home}/XSLT_Reports/">
<include name="**/*.zip"/>
</fileset>
</attachments>
</mail>
</target>
</project>
无法找出错误,帮助我找出解决方案......
答案 0 :(得分:1)
根据xml中的指定位置检查是否有jxl和jExcel。即。 d:\ JAR-文件
答案 1 :(得分:0)
问题解决了:我将dx驱动器中的jxl.jar文件放在了一个名为jxl.jar的文件夹中,所以我将jar文件从文件夹中移出并删除了该文件夹,现在它正在工作。