<file path="testx/ClassOneTest.xoo">
<testCase name="test1" duration="5"/>
<testCase name="test2" duration="500">
- <skipped message="short message"/>
+ <skipped/>
</testCase>
<testCase name="test3" duration="100">
- <failure message="short"/>
+ <failure/>
</testCase>
<testCase name="test4" duration="500">
- <error message="short"/>
+ <error/>
</testCase>
</file>
</testExecutions>
* `testCase` (mandatory)
* `name` (mandatory): name of the test case
* `duration` (mandatory): long value in milliseconds
- * `failure|error|skipped` (optional): if the test is not OK, report the cause with a message.
- * `message` (mandatory): short message describing the cause. This attribute is mandatory but not displayed in the UI.
\ No newline at end of file
+ * `failure|error|skipped` (optional): if the test is not OK, report its status.
private Long durationInMs;
private Status status;
private String name;
- private String message;
public String type() {
return type;
this.name = s;
return this;
}
-
- public String message() {
- return message;
- }
-
- public DefaultTestCase setMessage(String s) {
- this.message = s;
- return this;
- }
}
private static final String NAME_ATTR = "name";
private static final String DURATION_ATTR = "duration";
- private static final String MESSAGE_ATTR = "message";
- public static final String OK = "ok";
+
public static final String ERROR = "error";
public static final String FAILURE = "failure";
public static final String SKIPPED = "skipped";
} else if (ERROR.equals(elementName)) {
status = Status.ERROR;
}
- if (Status.OK != status) {
- testCase.setMessage(mandatoryAttribute(child, MESSAGE_ATTR));
- }
}
testCase.setStatus(status);
@Test
public void getters_after_setters() {
testCase
- .setMessage("message")
.setName("name")
.setType("type")
.setDurationInMs(1234L)
assertThat(testCase.name()).isEqualTo("name");
assertThat(testCase.type()).isEqualTo("type");
assertThat(testCase.durationInMs()).isEqualTo(1234L);
- assertThat(testCase.message()).isEqualTo("message");
}
}
parseUnitTestReport("<unitTest version=\"2\"></unitTest>");
}
- @Test(expected = MessageException.class)
- public void unittest_duration_in_testCase_should_be_a_number() throws Exception {
- addFileToFs(setupFile("file1"));
- parseUnitTestReport("<unitTest version=\"1\"><file path=\"file1\">"
- + "<testCase name=\"test1\" duration=\"aaa\"/></file></unitTest>");
- }
-
- @Test(expected = MessageException.class)
- public void unittest_failure_should_have_a_message() throws Exception {
- addFileToFs(setupFile("file1"));
- parseUnitTestReport("<unitTest version=\"1\"><file path=\"file1\">"
- + "<testCase name=\"test1\" duration=\"2\"><failure /></testCase></file></unitTest>");
- }
-
- @Test(expected = MessageException.class)
- public void unittest_error_should_have_a_message() throws Exception {
- addFileToFs(setupFile("file1"));
- parseUnitTestReport("<unitTest version=\"1\"><file path=\"file1\">"
- + "<testCase name=\"test1\" duration=\"2\"><error /></testCase></file></unitTest>");
- }
-
- @Test(expected = MessageException.class)
- public void unittest_skipped_should_have_a_message() throws Exception {
- addFileToFs(setupFile("file1"));
- parseUnitTestReport("<unitTest version=\"1\"><file path=\"file1\">"
- + "<testCase name=\"test1\" duration=\"2\"><skipped notmessage=\"\"/></testCase></file></unitTest>");
- }
-
@Test(expected = MessageException.class)
public void unittest_duration_in_testCase_should_not_be_negative() throws Exception {
addFileToFs(setupFile("file1"));
DefaultTestCase testCase = mock(DefaultTestCase.class);
when(testCase.setDurationInMs(anyLong())).thenReturn(testCase);
when(testCase.setStatus(any(DefaultTestCase.Status.class))).thenReturn(testCase);
- when(testCase.setMessage(anyString())).thenReturn(testCase);
when(testCase.setType(anyString())).thenReturn(testCase);
return testCase;
}
<file path="src/main/java/com/example/ClassWithoutBranch.java">
<testCase name="test1" duration="5"/>
<testCase name="test2" duration="500">
- <skipped message="short message">other</skipped>
+ <skipped>other</skipped>
</testCase>
<testCase name="test3" duration="100">
- <failure message="short">stacktrace</failure>
+ <failure>stacktrace</failure>
</testCase>
<testCase name="test4" duration="500">
- <error message="short">stacktrace</error>
+ <error>stacktrace</error>
</testCase>
</file>
</unitTest>
<file path="src/main/java/com/example/EmptyClass.java"/>
<file path="src/main/java/com/example/ClassWithBranches.java">
<testCase name="test1" duration="500">
- <skipped message="short message">other</skipped>
+ <skipped>other</skipped>
</testCase>
<testCase name="test2" duration="300">
- <failure message="short">stacktrace</failure>
+ <failure>stacktrace</failure>
</testCase>
<testCase name="test3" duration="300" />
<testCase name="test4" duration="300">
- <ok message="aaa">long</ok>
+ <ok>long</ok>
</testCase>
</file>
</unitTest>
<file path="testx/ClassOneTest.xoo">
<testCase name="test1" duration="5"/>
<testCase name="test2" duration="500">
- <skipped message="short message">other</skipped>
+ <skipped>other</skipped>
</testCase>
<testCase name="test3" duration="100">
- <failure message="short">stacktrace</failure>
+ <failure>stacktrace</failure>
</testCase>
<testCase name="test4" duration="500">
- <error message="short">stacktrace</error>
+ <error>stacktrace</error>
</testCase>
</file>
</testExecutions>
<file path="testx/ClassOneTest.xoo">
<testCase name="test1b" duration="5"/>
<testCase name="test2" duration="500">
- <skipped message="short message">other</skipped>
+ <skipped>other</skipped>
</testCase>
</file>
</testExecutions>