EmailResultReporter
public
class
EmailResultReporter
extends CollectingTestListener
implements
ITestSummaryListener
java.lang.Object | ||
↳ | com.android.tradefed.result.CollectingTestListener | |
↳ | com.android.tradefed.result.EmailResultReporter |
A simple result reporter base class that sends emails for test results.
Subclasses should determine whether an email needs to be sent, and can
override other behavior.
Summary
Public constructors | |
---|---|
EmailResultReporter()
Create a |
Protected constructors | |
---|---|
EmailResultReporter(IEmail mailer)
Create a |
Public methods | |
---|---|
void
|
addDestination(String dest)
Adds an email destination address. |
void
|
invocationEnded(long elapsedTime)
|
void
|
invocationFailed(Throwable t)
|
void
|
putSummary(
|
Protected methods | |
---|---|
|
fetchSummaries()
Allow subclasses to get at the summaries we've received |
String
|
generateEmailBody()
A method to generate the body for email reports. |
String
|
generateEmailSubject()
A method to generate the subject for email reports. |
Throwable
|
getInvocationException()
Returns the |
String
|
getInvocationOrTestStatus()
|
InvocationStatus
|
getInvocationStatus()
Returns the |
boolean
|
isHtml()
|
void
|
setHtml(boolean html)
A method to set a flag indicating that the email body is in HTML rather than plain text This method must be called before the email body is generated |
boolean
|
shouldSendMessage()
A method, meant to be overridden, which should do whatever filtering is decided and determine whether a notification email should be sent for the test results. |
Public constructors
Protected constructors
EmailResultReporter
protected EmailResultReporter (IEmail mailer)
Create a EmailResultReporter
with a custom IEmail
instance to use.
Parameters | |
---|---|
mailer |
IEmail : the IEmail instance to use.
|
Public methods
addDestination
public void addDestination (String dest)
Adds an email destination address.
invocationEnded
public void invocationEnded (long elapsedTime)
Parameters | |
---|---|
elapsedTime |
long |
invocationFailed
public void invocationFailed (Throwable t)
Parameters | |
---|---|
t |
Throwable |
putSummary
public void putSummary (summaries)
Parameters | |
---|---|
summaries |
|
Protected methods
fetchSummaries
protectedfetchSummaries ()
Allow subclasses to get at the summaries we've received
Returns | |
---|---|
|
generateEmailBody
protected String generateEmailBody ()
A method to generate the body for email reports. Will not be called if
shouldSendMessage()
returns false
.
Returns | |
---|---|
String |
A String containing the body to use for an email report
|
generateEmailSubject
protected String generateEmailSubject ()
A method to generate the subject for email reports. Will not be called if
shouldSendMessage()
returns false
.
- "Tradefed result for powerChromeFullSitesLocal on mantaray-user git_jb-mr1.1-release JDQ39: FAILED"
- "Tradefed result for Monkey on build 25: FAILED"
Returns | |
---|---|
String |
A String containing the subject to use for an email
report
|
getInvocationException
protected Throwable getInvocationException ()
Returns the Throwable
passed via invocationFailed(Throwable)
.
Returns | |
---|---|
Throwable |
getInvocationOrTestStatus
protected String getInvocationOrTestStatus ()
Returns | |
---|---|
String |
getInvocationStatus
protected InvocationStatus getInvocationStatus ()
Returns the InvocationStatus
Returns | |
---|---|
InvocationStatus |
isHtml
protected boolean isHtml ()
Returns | |
---|---|
boolean |
setHtml
protected void setHtml (boolean html)
A method to set a flag indicating that the email body is in HTML rather than plain text This method must be called before the email body is generated
Parameters | |
---|---|
html |
boolean : true if the body is html
|
shouldSendMessage
protected boolean shouldSendMessage ()
A method, meant to be overridden, which should do whatever filtering is decided and determine whether a notification email should be sent for the test results. Presumably, would consider how many (if any) tests failed, prior failures of the same tests, etc.
Returns | |
---|---|
boolean |
true if a notification email should be sent, false if not
|