2012-07-09 3 views
0

ANT 및 JUnit을 처음 사용합니다. 요구 사항에 따라 Eclipse에서 'JUnitTestCase'를 만들고 적절한 주석 당 요청 된 테스트 클래스를 호출합니다. '개미 빌드'를 통해 'build.xml 파일'파일을 실행하는 동안, 그것은 같은 오류가 발생합니다 :build.xml에서 주석 오류가 발생합니다.

D:\ecllipse\eclipse\JunitTestProject>ant compile 
Buildfile: D:\ecllipse\eclipse\JunitTestProject\build.xml 
setClassPath: 
init: 
clean: 
compile: 
[echo] making directory... 
[echo] classpath------: 
[echo] compiling... 
[javac] Compiling 4 source files to D:\ecllipse\eclipse\JunitTestProject\build 
[javac] D:\ecllipse\eclipse\JunitTestProject\src\jnuittestPckg\HelloWorldTest.java:3: package org.junit does not exist 
[javac]  import org.junit.After; 
[javac]     ^ 
[javac] D:\ecllipse\eclipse\JunitTestProject\src\jnuittestPckg\HelloWorldTes 
t.java:4: package org.junit does not exist 
[javac]  import org.junit.Before; 
[javac]     ^ 

다시 JUnitTEstCase을 보는 동안, 난 (수입 org.junit.After 같은 주석을 가져온, 수입 조직 .junit.Before 및 org.junit.Test; 가져 오기). 나 또한 'junit.jar'빌드 경로를 설정했다. 나는 많은 노력을했지만 알아낼 수 없었다. 나는 또한으로 JUnitTest 프로젝트를 부착하고있다 :

package jnuittestPckg; 

import org.junit.After; 
import org.junit.Before; 
import org.junit.Test; 

공용 클래스 HelloWorldTest {
민간하여 HelloWorld hlwrd;

@Before 
public void setUp() throws Exception { 
hlwrd = new HelloWorld(); 
System.out.println("I am in Before"); 
} 

@After 
public void tearDown() throws Exception { 
System.out.println("I am in After"); 
} 

@Test 
public void testClass1() { 
    hlwrd.Class1(null); 
} 

@Test 
public void testClass2() { 
    hlwrd.Class2(null); 
} 

}

저를 도와주세요.

+0

우리에게 javac의 작업 –

+0

안녕 Aviram, 내가 javac의 작업을 붙여 넣기하고보기 true ""quiet ""true "> 을 포함합니다. < javac \t debug = "true" \t destdir = "$ {test.dest}" \t SRCDIR = "$ {test.src}" \t 대상 = "1.5" \t 클래스 경로 = "$ {test.classpath}" \t includeantruntime> 가난한 형식 죄송 – abhineet

+0

= "false"를, 나를 도울 필요가있는 것이 있으면 알려주십시오. – abhineet

답변

0

test.classpath 등록 정보에는 junit.jar이 포함되지 않습니다. 클래스 경로에 추가하면이 문제가 해결됩니다. " <- - 컴파일!> :

관련 문제