Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SUREFIRE-2219] Add test stdErr/stdOut output to ReportTestCase #692

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public final class ReportTestCase {
private String failureErrorLine;

private String failureDetail;
private String systemOut;
private String systemErr;

private boolean hasFailure;

Expand Down Expand Up @@ -138,6 +140,24 @@ public ReportTestCase setError(String message, String type) {
return setFailureMessage(message).setFailureType(type);
}

public String getSystemOut() {
return systemOut;
}

public ReportTestCase setSystemOut(String message) {
systemOut = message;
return this;
}

public String getSystemErr() {
return systemErr;
}

public ReportTestCase setSystemErr(String message) {
systemErr = message;
return this;
}

public ReportTestCase setSkipped(String message) {
hasFailure = false;
hasError = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ public void startElement(String uri, String localName, String qName, Attributes
testCase.setError(attributes.getValue("message"), attributes.getValue("type"));
currentSuite.incrementNumberOfErrors();
break;
case "system-out":
case "system-err":
currentElement = new StringBuilder();
parseContent = true;
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incomplete/imprecise. Look at the schema: https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd. Testcase can have stdout/stderr, but also reruns and flakes. We should basically overwrite in that case. We need a way to make sure that these are direct descendants.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My PR ist half a year old. I created it, because you asked me to. It is meant to be something you can commit on top of and refine. "Allow edits by maintainers" is active for this PR. Please do so.

Currently, my personal situation does not permit me to spend time on it, because on top of being busy with work I am in the process of relocating to another continent and was also thrown back by a recent stay in hospital after an accident, which cost me extra time. This is not an excuse, just an explanation. I am still interested in getting this issue resolved, only the time window to further collaborate on it has closed for now.

case "skipped":
String message = attributes.getValue("message");
testCase.setSkipped(message != null ? message : "skipped");
Expand Down Expand Up @@ -210,6 +215,12 @@ public void endElement(String uri, String localName, String qName) throws SAXExc
testCase.setFailureDetail(currentElement.toString())
.setFailureErrorLine(parseErrorLine(currentElement, testCase.getFullClassName()));
break;
case "system-out":
testCase.setSystemOut(currentElement.toString());
break;
case "system-err":
testCase.setSystemErr(currentElement.toString());
break;
case "time":
try {
defaultSuite.setTimeElapsed(Float.parseFloat(currentElement.toString()));
Expand Down