Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/352.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 Surefire JUnit测试不会在测试xml文件中记录失败的假定_Java_Maven_Junit_Surefire - Fatal编程技术网

Java Surefire JUnit测试不会在测试xml文件中记录失败的假定

Java Surefire JUnit测试不会在测试xml文件中记录失败的假定,java,maven,junit,surefire,Java,Maven,Junit,Surefire,我正在使用 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.16</version> </plugin> 当我使用maven构建项目时,我在SureFireXML文件中得到以下代码片段 <testc

我正在使用

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.16</version>
</plugin>
当我使用maven构建项目时,我在SureFireXML文件中得到以下代码片段

<testcase name="test" classname="com.stackoverflower.experiment.Test" time="0">
    <skipped/>
</testcase>

我认为这不是surefire的正确行为,因为假设失败被视为与忽略相同,所以它应该遵循与忽略相同的日志记录标准。清楚地说应该记录原因

你觉得怎么样?是否有一种变通方法可以将该消息放入xml文件中

谢谢

更新1


我不能使用@Ignore的原因是我不想硬编码一个被忽略的测试。我希望基于一些在编码时无法确定的前提条件跳过它。

数据点的组合对给定的
理论无效时,通常使用的
假设
方法。您应该使用该类,而不是
假定
。以下是您的示例测试,重新编写以使用正确的类:

@Test
public void test() throws IOException {
    Assert.assertTrue("I am broken", false);
    // some tests
}

这意味着可以忽略错误的假设,如

中所述,您的测试类顶部是否有
@org.junit.Ignore
?@jw23,请查看我的更新
<testcase name="test" classname="com.stackoverflower.experiment.Test" time="0">
    <skipped/>
</testcase>
@Test
public void test() throws IOException {
    Assert.assertTrue("I am broken", false);
    // some tests
}