1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.compatibility.common.util; 17 18 /** 19 * Represents a single test result. 20 */ 21 public interface ITestResult extends Comparable<ITestResult> { 22 23 /** 24 * @return The name of this test result. 25 */ getName()26 String getName(); 27 28 /** 29 * @return The full name of this test result, ie 30 * <package-name>.<class-name>#<method-name> 31 */ getFullName()32 String getFullName(); 33 34 /** 35 * @return The {@link TestStatus} of this result. 36 */ getResultStatus()37 TestStatus getResultStatus(); 38 39 /** 40 * Sets the {@link TestStatus} of the result and updates the end time of the test. 41 * 42 * @param status The {@link TestStatus} of this result. 43 */ setResultStatus(TestStatus status)44 void setResultStatus(TestStatus status); 45 46 /** 47 * @return The failure message to display 48 */ getMessage()49 String getMessage(); 50 51 /** 52 * @param message The message to display which describes the failure 53 */ setMessage(String message)54 void setMessage(String message); 55 56 /** 57 * @return The stack trace generated by the failure 58 */ getStackTrace()59 String getStackTrace(); 60 61 /** 62 * @param stackTrace the stack trace generated by the failure. 63 */ setStackTrace(String stackTrace)64 void setStackTrace(String stackTrace); 65 66 /** 67 * @return the metrics report. 68 */ getReportLog()69 ReportLog getReportLog(); 70 71 /** 72 * @param report the metrics report. 73 */ setReportLog(ReportLog report)74 void setReportLog(ReportLog report); 75 76 /** 77 * @return the path of the bug report generated of the failure. 78 */ getBugReport()79 String getBugReport(); 80 81 /** 82 * @param path the path of the bug report generated of the failure. 83 */ setBugReport(String path)84 void setBugReport(String path); 85 86 /** 87 * @return the path of the log file generated of the failure. 88 */ getLog()89 String getLog(); 90 91 /** 92 * @param path the path of the log file generated of the failure. 93 */ setLog(String path)94 void setLog(String path); 95 96 /** 97 * @return the path of the screenshot file generated of the failure. 98 */ getScreenshot()99 String getScreenshot(); 100 101 /** 102 * @param path the path of the screenshot file generated of the failure. 103 */ setScreenshot(String path)104 void setScreenshot(String path); 105 106 /** 107 * Report the test as a failure. 108 * 109 * @param trace the stacktrace of the failure. 110 */ failed(String trace)111 void failed(String trace); 112 113 /** 114 * Report that the test has completed. 115 * 116 * @param report A report generated by the test, or null. 117 */ passed(ReportLog report)118 void passed(ReportLog report); 119 120 /** 121 * Report that the test was skipped. 122 * 123 * This means that the test is not considered appropriate for the 124 * current device, and thus is never attempted. The test does not require execution, 125 * and nothing more needs to be done. 126 */ skipped()127 void skipped(); 128 129 /** 130 * Retrieves whether execution for this test result has been determined unnecessary. 131 */ isSkipped()132 boolean isSkipped(); 133 134 /** 135 * Resets the result. 136 */ reset()137 void reset(); 138 139 /** 140 * Sets whether the test result status has been generated from a previous testing session. 141 */ setRetry(boolean isRetry)142 void setRetry(boolean isRetry); 143 144 /** 145 * Retrieves whether the test result status has been generated from a previous testing session. 146 */ isRetry()147 boolean isRetry(); 148 149 /** 150 * Clear the existing result and default to 'failed' 151 */ removeResult()152 void removeResult(); 153 } 154