How to Display jUnit Errors Via Ant

前端 未结 2 387
忘了有多久
忘了有多久 2021-01-21 06:48

I am trying to add an Ant script to my company\'s project to run the jUnit tests. Here is what I have:


    
              


        
相关标签:
2条回答
  • 2021-01-21 07:23

    Found the answer. Needed to add a formatter.

    <target name="unit-tests">
        <junit>
            <classpath>
                <pathelement location="${project.libext.dir}/junit-4.1.jar"/>
            </classpath>
            <formatter type="plain" usefile="false" />
            <batchtest>
                <fileset dir="${project.src-test.dir}/my/company/." />
            </batchtest>
        </junit>
    </target>
    
    0 讨论(0)
  • 2021-01-21 07:36

    You can't print the full stack trace from the tests in the Ant output AFAIK; it's embedded in the JUnit report file. You can either browse that separately, or if you're using a continuous integration server such as Jenkins or CruiseControl to run your builds, you can set up a plugin that will link to the test reports.

    0 讨论(0)
提交回复
热议问题