简体   繁体   English

如果我通过Eclipse中的ANT运行测试用例,则不会在JUNIT文件夹中生成JUnit HTML报告(index.html)。

[英]JUnit HTML report (index.html) is not generated in the JUNIT folder, If I run the test case through ANT in eclipse

I am running the JUnit test cases through ANT in eclipse, the build is successful, however the JUnit Html report of the test cases (index.html) is not generated in the JUnit folder. 我正在Eclipse中通过ANT运行JUnit测试用例,构建成功,但是在JUnit文件夹中未生成测试用例的JUnit Html报告(index.html)。

Following are the versions: 以下是版本:

ANT: apache-ant-1.9.4 JUnit: junit 4.11 Jar file Eclipse: Version: 3.7.2 ANT:apache-ant-1.9.4 JUnit:junit 4.11 Jar文件Eclipse:版本:3.7.2

Please help! 请帮忙!

I assume that you are using ant junit task for running testcases. 我假设您正在使用ant junit任务运行测试用例。 However, to generate HTML report, you need to add junit report task. 但是,要生成HTML报告,您需要添加junit报告任务。 Please, see example above 请参阅上面的示例

<target name="test-html">
  <junit fork="yes" printsummary="no" haltonfailure="no">
    <batchtest fork="yes" todir="${test.reports}" >
      <fileset dir="${classes}">
        <include name="**/*Test.class" />
      </fileset>
    </batchtest>
    <formatter type="xml" />
    <classpath refid="test.classpath" />
  </junit>

  <junitreport todir="${test.reports}">
    <fileset dir="${test.reports}">
      <include name="TEST-*.xml" />
    </fileset>
    <report todir="${test.reports}" />
  </junitreport>
</target>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM