0
하나의 함수가있는 다음 클래스를 컴파일하려고합니다.개미가 기호 @ Test를 찾을 수 없습니다.
공용 클래스 TestAnnotations {
@Test
public void testLogin(){
System.out.println("Testing Login");
}
나는 그것이 작동의 JUnit으로 파일을 실행하지만
나는 그것이 나에게 다음과 같은 오류를 제공 build.xml 파일에서 파일을 실행하려고하면 기호 @Test를 찾을 수 없습니다. 올바른 위치에 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>
개미가 성공적으로 프로젝트 빌드하지만 당신은의 JUnit 라이브러리를 추가해야 할 수도 컴파일
도이 템플릿을 살펴있을 수 있습니다 https://github.com/mplacona/java-junit-template-project –
이 일을 당신이 클래스 경로에 junit.jar를 경로를 넣어 감사합니다. 고맙습니다. –
다른 문제가 있습니다. 내 스크립트에서 IEDriver를 사용하려고하지만 ant에서 컴파일 할 때 오류가 발생합니다. error : package org.openqa.selenium.ie가 존재하지 않습니다. 이 문제를 어떻게 해결할 수 있습니까? –