尝试编译build.xml文件并收到以下错误
1。 java:3:错误:包org.testng.annotations不存在 [javac] import org.testng.annotations.Test; 2. java:7:错误:无法找到符号@Test
我已经附加了我的build.xml文件。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project []>
<project name="Selenium" default="usage" basedir=".">
<!-- ========== Initialize Properties =================================== -->
<property environment="env" />
<property name="ws.home" value="${basedir}" />
<property name="ws.jars" value="/Users/stakhivigor/Documents/Automation/jars" />
<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 -->
<property name="src" location="src" />
<property name="build" location="build" />
<target name="compile">
<mkdir dir="${build}" />
<javac srcdir="${src}" destdir="${build}" includeantruntime="false" />
<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 includeantruntime="false" 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="Automation Test">
<xmlfileset dir="${ws.home}" includes="testng.xml" />
</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>
</project>