Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/335.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 丰富用Ant生成的HTML报告?_Java_Html_Ant_Junit_Jenkins - Fatal编程技术网

Java 丰富用Ant生成的HTML报告?

Java 丰富用Ant生成的HTML报告?,java,html,ant,junit,jenkins,Java,Html,Ant,Junit,Jenkins,我为一家公司安装了Jenkins服务器,为我实习的公司编译和测试代码 现在它制作了一个非常棒的HTML报告,但是它缺少一条似乎可以使它完整的信息。这将是我在测试类中执行的System.out.println()的输出 下面是从我的antbuild.xml文件生成报告的目标: <target name="test-report-systemtest" depends="compile-omittedmanage-systemtest" description="Generate Test R

我为一家公司安装了Jenkins服务器,为我实习的公司编译和测试代码

现在它制作了一个非常棒的HTML报告,但是它缺少一条似乎可以使它完整的信息。这将是我在测试类中执行的
System.out.println()
的输出

下面是从我的ant
build.xml
文件生成报告的目标:

<target name="test-report-systemtest" depends="compile-omittedmanage-systemtest" description="Generate Test Results as HTML">
    <delete dir="${deploy}\html" />
    <delete dir="${deploy}\xml" />
    <mkdir dir="${deploy}\html" />
    <mkdir dir="${deploy}\xml" />
    <mkdir dir="${omittedmanage-systemtestbin}" />
    <taskdef name="junitreport" classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator" />
    <coverage>
        <junit printsummary="on" haltonfailure="off" haltonerror="off" fork="yes">
            <batchtest fork="yes" todir="${deploy}" filtertrace="on">
                <fileset dir="${omittedmanage-unittestbin}" includes="**/*Test*.class" />
            </batchtest>
            <formatter type="plain" usefile="false" />
            <formatter type="xml" usefile="true" />
            <classpath>
                <path refid="omittedManage.classpath" />
            </classpath>
        </junit>
    </coverage>
    <echo message="running JUnit Report" />
    <junitreport todir="${deploy}\xml">
        <fileset dir="${deploy}\xml">
            <include name="Test-*.xml" />
        </fileset>
        <report format="frames" todir="${deploy}\html" />
    </junitreport>
</target>

我得到的是:

这真的很好,但如果能写一些东西,比如“输出”,上面写着“类型”,那就太好了。然后,我可以用Java中的某种消息来填充它。这是测试本身(它被参数化了,所以它从另一个方法中提取一个“True/False”和一个字符串,放入这个测试方法中,并断言True或False:

@Test
public void testValidationOfFICheckCipher()
{
    try {
        System.out.println("Checking validity of EAN Checksum: " + eanString);
        boolean expect = new Boolean(expected);
        boolean value = new Boolean(CheckSums.validateEAN13(eanString));
        assertEquals(expect, value);
    } catch(NumberFormatException e) {
        System.out.println(e.getMessage());
        assertTrue((eanString.length() < 13) || (eanString.length() > 13));
    }

}
@测试
public void testvalidationOfficeCheckCipher()
{
试一试{
System.out.println(“检查EAN校验和的有效性:+eanString”);
布尔期望值=新布尔值(期望值);
布尔值=新的布尔值(CheckSums.validateEAN13(eanString));
资产质量(预期、价值);
}捕获(数字格式){
System.out.println(e.getMessage());
assertTrue((eanString.length()<13)| |(eanString.length()>13));
}
}

我真的希望有这样一行:
“检查EAN校验和的有效性:”+eanString
出现在我的HTML报告中。但我真的不知道如何实现这一点……有人知道吗?

这是一个老问题,但你是否找到了一种方法使系统输出和系统错误可见?@lolung我不这么认为:/但即使我当时这样做了,也不意味着它今天也会起作用。