Closed Atari361 closed 5 months ago
@Atari361 thanks for the PR. As I cannot write on your original repo, my recommendation would be to change the PR code to something like this on lines 340-355 of XrayJsonReporter.java
if (results.size() == 1) {
// regular test; non data-driven
ITestResult result = results.get(0);
String start = dateFormatter.format(result.getStartMillis());
String finish = dateFormatter.format(result.getEndMillis());
test.put("start", start);
test.put("finish", finish);
test.put("status", getTestStatus(result.getStatus()));
Throwable throwable = result.getThrowable();
if (result.getStatus() == ITestResult.FAILURE && throwable != null && throwable.getMessage() != null)
test.put("comment", throwable.getMessage());
// process attachments
processAttachments(result, test);
}
I'm not sure why the build still fails here on GH on the PR, even though I've checked out the code locally and it runs. any ideas?
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
No data about Duplication
org.testng.ITestResult#getThrowable
sometimes can havedetailMessage=null
, and this results injson-report.json
having"comment":null
and later a rejection from API when importing results via '/api/v2/import/execution' (Xray Cloud).TestNG test example that generates detailMessage=null:
This PR adds an extra
detailMessage != null
check to favoid adding null comment.