0
我想编译下面的类,它只有一个函数。蚂蚁找不到符号@测试
公共类TestAnnotations {
@Test
public void testLogin(){
System.out.println("Testing Login");
}
当我运行该文件的JUnit它的工作原理,但是当我尝试从build.xml文件它给了我下面的错误文件:找不到符号@测试。我的Junit.jar文件位于正确的位置。这里是我的build.xml脚本:
<property environment = "env"/>
<property name="ws.home" value="${basedir}" />
<property name="ws.jars" value="D:/Data/eclipse/workspace/SeleniumDemo/lib/oracle_junit/junit.jar"/>
<property name="test.dest" value="${ws.home}/build" />
<property name="test.src" value="${ws.home}/src" />
<property name="test.reportDir" value="C:/reports"/>
<path id="testcase.path">
<pathelement location="${test.dest}" />
<fileset dir="${ws.jars}">
<include name="*.jar" />
</fileset>
</path>
<target name="init">
<mkdir dir="build/classes" />
</target>
<target name="clean">
<delete dir="${test.dest}" />
</target>
<target name="compile" depends = "init, clean">
<delete includeemptydirs= "true" quiet="true">
<fileset dir = "${test.dest}" includes = "**/*"/>
</delete>
<mkdir dir = "${test.dest}"/>
<javac
debug = "true"
destdir = "${test.dest}"
includeantruntime = "false"
srcdir = "${test.src}"
target = "1.7"
classpath = "${test.classpath}"
>
</javac>
</target>
<target name="run">
<fileset dir="${test.dest}">
<include name="tests/TestAnnotations.class" />
</fileset>
</target>
蚂蚁构建成功的项目,但它在编译
@Shabeer你可能看一下这个模板,也:https://github.com/mplacona/java-junit-template-project –
谢谢投入的junit.jar路径classpath中工作。谢谢。 –
我陷入了另一个问题。我想在我的脚本中使用IEDriver,但是当我在ant中编译时,出现错误:error:package org.openqa.selenium.ie does not exist。我该如何解决这个问题 –