Skip to content

Commit

Permalink
Support configurable start time - emailable report (#2476)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bazzani committed Feb 7, 2021
1 parent 7fed142 commit e016840
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.txt
@@ -1,4 +1,5 @@
Current
New : GITHUB-2459: Support configurable start time - emailable report (Barry Evans)
Fixed: GITHUB-2467: XmlTest does not copy the xmlClasses during clone (C.V.Aditya)
Fixed: GITHUB-2469: Parameters added in XmlTest during AlterSuiteListener not available in SuiteListener (C.V.Aditya)
Fixed: GITHUB-2296: Fix for assertEquals not working for sets as order is not guaranteed. (Prashant Maroti)
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/testng/reporters/EmailableReporter2.java
Expand Up @@ -344,7 +344,7 @@ private int writeScenarioSummary(
.append("<td rowspan=\"")
.append(resultsCount)
.append("\">")
.append(start)
.append(getFormattedStartTime(start))
.append("</td>")
.append("<td rowspan=\"")
.append(resultsCount)
Expand Down Expand Up @@ -389,6 +389,10 @@ private int writeScenarioSummary(
return scenarioCount;
}

protected String getFormattedStartTime(long startTimeInMillisFromEpoch) {
return String.valueOf(startTimeInMillisFromEpoch);
}

/** Writes the details for all test scenarios. */
protected void writeScenarioDetails() {
int scenarioIndex = 0;
Expand Down

0 comments on commit e016840

Please sign in to comment.