Home | History | Annotate | Download | only in util
      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      */
     26     String getName();
     27 
     28     /**
     29      * @return The full name of this test result, ie
     30      * &lt;package-name&gt;.&lt;class-name&gt;#&lt;method-name&gt;
     31      */
     32     String getFullName();
     33 
     34     /**
     35      * @return The {@link TestStatus} of this result.
     36      */
     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      */
     44     void setResultStatus(TestStatus status);
     45 
     46     /**
     47      * @return The failure message to display
     48      */
     49     String getMessage();
     50 
     51     /**
     52      * @param message The message to display which describes the failure
     53      */
     54     void setMessage(String message);
     55 
     56     /**
     57      * @return The stack trace generated by the failure
     58      */
     59     String getStackTrace();
     60 
     61     /**
     62      * @param stackTrace the stack trace generated by the failure.
     63      */
     64     void setStackTrace(String stackTrace);
     65 
     66     /**
     67      * @return the metrics report.
     68      */
     69     ReportLog getReportLog();
     70 
     71     /**
     72      * @param report the metrics report.
     73      */
     74     void setReportLog(ReportLog report);
     75 
     76     /**
     77      * @return the path of the bug report generated of the failure.
     78      */
     79     String getBugReport();
     80 
     81     /**
     82      * @param path the path of the bug report generated of the failure.
     83      */
     84     void setBugReport(String path);
     85 
     86     /**
     87      * @return the path of the log file generated of the failure.
     88      */
     89     String getLog();
     90 
     91     /**
     92      * @param path the path of the log file generated of the failure.
     93      */
     94     void setLog(String path);
     95 
     96     /**
     97      * @return the path of the screenshot file generated of the failure.
     98      */
     99     String getScreenshot();
    100 
    101     /**
    102      * @param path the path of the screenshot file generated of the failure.
    103      */
    104     void setScreenshot(String path);
    105 
    106     /**
    107      * Report the test as a failure.
    108      *
    109      * @param trace the stacktrace of the failure.
    110      */
    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      */
    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      */
    127     void skipped();
    128 
    129     /**
    130      * Retrieves whether execution for this test result has been determined unnecessary.
    131      */
    132     boolean isSkipped();
    133 
    134     /**
    135      * Resets the result.
    136      */
    137     void reset();
    138 
    139     /**
    140      * Sets whether the test result status has been generated from a previous testing session.
    141      */
    142     void setRetry(boolean isRetry);
    143 
    144     /**
    145      * Retrieves whether the test result status has been generated from a previous testing session.
    146      */
    147     boolean isRetry();
    148 
    149     /**
    150      * Clear the existing result and default to 'failed'
    151      */
    152     void removeResult();
    153 }
    154