Skip to content

Commit e016840

Browse files
authored
Support configurable start time - emailable report (#2476)
The `EmailableReport2` class provides test start time values which are in millisecond value from the epoch (01/01/1970 00:00:00): - sample value `1610359715103` - GMT : January 11, 2021 Monday 10: 08: 35.103 - see `test-output/emailable-report.html` for start time report usage - see https://www.epochconverter.com/clock This value is not very human readable, and this change adds a protected method which can be overridden in sub classes to provide a more human readable version of the test start time (e.g. `2021-01-01 12:34:56`) Fixes #2459
1 parent 7fed142 commit e016840

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Current
2+
New : GITHUB-2459: Support configurable start time - emailable report (Barry Evans)
23
Fixed: GITHUB-2467: XmlTest does not copy the xmlClasses during clone (C.V.Aditya)
34
Fixed: GITHUB-2469: Parameters added in XmlTest during AlterSuiteListener not available in SuiteListener (C.V.Aditya)
45
Fixed: GITHUB-2296: Fix for assertEquals not working for sets as order is not guaranteed. (Prashant Maroti)

src/main/java/org/testng/reporters/EmailableReporter2.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ private int writeScenarioSummary(
344344
.append("<td rowspan=\"")
345345
.append(resultsCount)
346346
.append("\">")
347-
.append(start)
347+
.append(getFormattedStartTime(start))
348348
.append("</td>")
349349
.append("<td rowspan=\"")
350350
.append(resultsCount)
@@ -389,6 +389,10 @@ private int writeScenarioSummary(
389389
return scenarioCount;
390390
}
391391

392+
protected String getFormattedStartTime(long startTimeInMillisFromEpoch) {
393+
return String.valueOf(startTimeInMillisFromEpoch);
394+
}
395+
392396
/** Writes the details for all test scenarios. */
393397
protected void writeScenarioDetails() {
394398
int scenarioIndex = 0;

0 commit comments

Comments
 (0)