2017-12-17 22 views
0

개미 테스트에서 추가 한 개미 프로젝트가 있습니다. 이것은 테스트를 실행하는 대상입니다. 나는 에코 문을 콘솔 또는 보고서에 인쇄되지 않습니다 ant test-build을 실행하면antunit 테스트의 에코가 표시되지 않습니다.

<target name="test-build" depends="init-build"> 
    <au:antunit> 
     <fileset file="test.xml"/> 
     <au:plainlistener/> 
     <au:xmllistener todir="${reports.antunit.dir}"/> 
    </au:antunit> 
</target> 

test.xml의이

<project xmlns:au="antlib:org.apache.ant.antunit"> 
    <include file="build.xml" as="main"/> 

    <target name="tearDown" depends="main.clean"/> 

    <target name="test-project-name"> 
     <echo>project name is ${ant.project.name}</echo> 
     <au:assertTrue> 
      <equals arg1="${ant.project.name}" arg2="gradle-to-ant"/> 
     </au:assertTrue> 
    </target> 
</project> 

것 같습니다.

test-build: 
[au:antunit] Build File: /etc/user/john/projects/gradle-to-ant/test.xml 
[au:antunit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.033 sec 
[au:antunit] Target: test-project-name took 0.012 sec 

BUILD SUCCESSFUL 
Total time: 0 seconds 

나는 다른 프로젝트에서 사용한 반향이 props 인 것을 보아왔다. 어떻게하면 에일 테스트 결과 에코를 작동시킬 수 있습니까?

답변

2

echo 작업의 출력이 캡처되어 어서션을 사용할 수 있습니다 (예 : assertLogContains). 소품에서는 대상을 수동으로 대전 방지 장치 외부에서 실행할 때처럼 echo이있는 것처럼 보입니다.

당신은 내가 아직 시도하지 못하고 그러나 나는 그것이 작동 확신 즉, 당신이 당신의 antunit 작업에 logforwarder testlistener를 추가 할 필요가 echo의 출력,

<au:antunit> 
    <fileset file="test.xml"/> 
    <au:plainlistener/> 
    <au:xmllistener todir="${reports.antunit.dir}"/> 
    <au:logforwarder/> 
</au:antunit> 
+0

를보고 싶다면 . 나는 또한 모든 assert 매크로를 보여주는 antlib.xml을 발견했다. 이것은 antunit을 배우려고하는 누군가에게 도움이됩니다. 또한 antunit의 개발에 참여하는 것에 대해 감사드립니다! –

+0

당신을 진심으로 환영합니다. Apache (또는 미러 중 하나)에서 AntUnit 배포판을 다운로드하면 매뉴얼이 포함됩니다. 웬일인지 우리는 이것이 이것을 기본 배포 지점으로 기대하기 때문에 매뉴얼을 온라인으로 보내지 않아도됩니다. –

+0

오, 좋을 것입니다. Im는 antunit를 설치하기 위해 아이비를 사용합니다. 이것은 프로젝트입니다. github.com/moaxcp/gradle-to-ant –