3

나는 완전히 고갈되었습니다. 젠킨스가 성공적으로 완료되지 않습니다 :)Jenkins/Hudson 테스트 보고서에는 결과가 전혀 포함되어 있지 않습니다.

어쩌면 당신 중 일부는 나를 도울 수 있습니까? ant jenkins 작업에는 javadoc 플러그인이 포함되고 html 보고서 플러그인 및 junit 테스트 결과 플러그인이 게시됩니다. 구성이 완료되었습니다 (예 : 어떠한 경로 변수하거나 어떤 ..

Started by an SCM change 
Started by user anonymous 
Building in workspace /var/lib/jenkins/jobs/TicTacToe/workspace 
Updating http://xxx.xxx.xxx.xxx/svn/repo/projekt at revision '2014-01-24T15:21:33.486 +0100' 
U   build.xml 
U   .classpath 
At revision 20 
[workspace] $ ant 
Buildfile: /var/lib/jenkins/jobs/TicTacToe/workspace/build.xml 

build-subprojects: 

init: 

build-project: 
    [echo] TicTacToe: /var/lib/jenkins/jobs/TicTacToe/workspace/build.xml 

build: 

BUILD SUCCESSFUL 
Total time: 0 seconds 
Publishing Javadoc 
[htmlpublisher] Archiving HTML reports... 
Recording test results 
None of the test reports contained any result 
Build step 'Publish JUnit test result report' changed build result to FAILURE 
Finished: FAILURE 

및 이클립스 구조 :

enter image description here

제 (단순) 시험 :

package tictactoe; 

import junit.framework.TestCase; 

import org.junit.Assert; 
import org.junit.Test; 

//@RunWith(Suite.class) 
//@SuiteClasses({Tests.class}) 
public class FieldTest extends TestCase { 
    @Test 
    public void testSchlange() { 
     String schlange = new String(); 
     Assert.assertTrue(schlange.isEmpty()); 
    } 

    @Test 
    public void testAdd() { 
    Assert.assertFalse(false); 
    } 
} 

과의 build.xml :

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!-- WARNING: Eclipse auto-generated file. 
       Any modifications will be overwritten. 
       To include a user specific buildfile here, simply create one in the same 
       directory with the processing instruction <?eclipse.ant.import?> 
       as the first entry and export the buildfile again. --><project basedir="." default="build" name="TicTacToe"> 
    <property environment="env"/> 
    <property name="ECLIPSE_HOME" value="../../"/> 
    <property name="junit.output.dir" value="junit"/> 
    <property name="debuglevel" value="source,lines,vars"/> 
    <property name="target" value="1.7"/> 
    <property name="source" value="1.7"/> 
    <path id="TicTacToe.classpath"> 
     <pathelement location="bin"/> 
     <pathelement location="jfxrt.jar"/> 
     <pathelement location="hamcrest-core-1.3.jar"/> 
     <pathelement location="junit-4.11.jar"/> 
    </path> 
    <target name="init"> 
     <mkdir dir="bin"/> 
     <copy includeemptydirs="false" todir="bin"> 
      <fileset dir="src"> 
       <exclude name="**/*.launch"/> 
       <exclude name="**/*.java"/> 
      </fileset> 
     </copy> 
    </target> 
    <target name="clean"> 
     <delete dir="bin"/> 
    </target> 
    <target depends="clean" name="cleanall"/> 
    <target depends="build-subprojects,build-project" name="build"/> 
    <target name="build-subprojects"/> 
    <target depends="init" name="build-project"> 
     <echo message="${ant.project.name}: ${ant.file}"/> 
     <javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}"> 
      <src path="src"/> 
      <classpath refid="TicTacToe.classpath"/> 
     </javac> 
    </target> 
    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/> 
    <target description="copy Eclipse compiler jars to ant lib directory" name="init-eclipse-compiler"> 
     <copy todir="${ant.library.dir}"> 
      <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> 
     </copy> 
     <unzip dest="${ant.library.dir}"> 
      <patternset includes="jdtCompilerAdapter.jar"/> 
      <fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/> 
     </unzip> 
    </target> 
    <target description="compile project with Eclipse compiler" name="build-eclipse-compiler"> 
     <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/> 
     <antcall target="build"/> 
    </target> 
    <target name="TicTacToe"> 
     <mkdir dir="${junit.output.dir}"/> 
     <junit fork="yes" printsummary="withOutAndErr"> 
      <formatter type="xml"/> 
      <test name="tictactoe.FieldTest" todir="${junit.output.dir}"/> 
      <classpath refid="TicTacToe.classpath"/> 
     </junit> 
    </target> 
    <target name="FieldTest"> 
     <mkdir dir="${junit.output.dir}"/> 
     <junit fork="yes" printsummary="withOutAndErr"> 
      <formatter type="xml"/> 
      <test name="tictactoe.FieldTest" todir="${junit.output.dir}"/> 
      <classpath refid="TicTacToe.classpath"/> 
     </junit> 
    </target> 
    <target name="junitreport"> 
     <junitreport todir="${junit.output.dir}"> 
      <fileset dir="${junit.output.dir}"> 
       <include name="TEST-*.xml"/> 
      </fileset> 
      <report format="frames" todir="${junit.output.dir}"/> 
     </junitreport> 
    </target> 
</project> 
+0

첫 번째 관점에서 볼 때 빌드 파일에서 junit-test-targets을 호출하지 않는다는 것 때문에 테스트 결과를 수집 할 수 없다는 것입니다. 실행 된 적이 없기 때문입니다. 데이터를 수집하기 전에 테스트가 실행되는지 확인할 수 있습니다. – crusam

+0

나는 완전히 그 주제에 대해 새롭다. 당신의 접근 방식에 대해 좀 더 자세히 설명해 주시겠습니까? 예 : "데이터를 수집하기 전에 테스트가 실행된다는 것을 확인하고 싶을 수 있습니다."하지만 좋은 방법이라고는 생각하지 않습니다.) –

답변

2

일반적으로 다음과 같은 방식으로 작동합니다. 앤트 스크립트를 시작한 후에 (속성이 정의 된 폴더를 만드는 작업, 클래스 파일에 정의 된 일부 Java 파일 수집,이 클래스 컴파일, 테스트 실행) 마침내 항아리를 만들었습니다.

첫 번째 개미가 어떤 작업 (대상)인지 알기 위해서는 일반적으로 빌드 프로세스를 시작하자마자 시작되는 기본 대상을 사용하십시오. 이 대상은 종속성 (관련 대상)이라고도하며, 시작하기 전에 먼저 완료해야합니다.

귀하의 경우 타겟이 귀하의 junit 타겟에 대한 의존성을 갖고 있지 않은 것으로 보입니다 (일부는 과장 된 것처럼 보이지만 TicTacToe와 FieldTest는 동일하게 보입니다). 또한 개미 스크립트가 자동으로 생성되고 수정 된 것 같습니다. 그것들을 수정하는 동안 junit 타겟을 타겟에 추가하는 것을 잊어 버리는 것 같기 때문에 ANT에서 몇 가지 기본 사항을 놓친다 고 생각합니다.

나는 다음을 읽기를 권합니다. tutorial. 자신의 개미 스크립트를 만들기 시작하는 데 도움이되며, 스크립트에 junit 테스트를 포함시키는 방법에 대한 장이 있습니다. Jenkins는 분명히 빌드를 시작하고 보고서를 생성하려고 했으므로 잘 구성된 것으로 보입니다. 성공하지 못했습니다. 왜냐하면 테스트가 보고서에 필요한 XML을 생성하기 시작한 적이 없기 때문에 빌드 프로세스가 성공적이더라도 빌드가 실패하게됩니다.

+0

감사합니다. upvote! –

관련 문제