Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.
         
       
     
  
  
  
  
  
    
    
      
    
    
      
      Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
  
  
JUnitToInvocationResultForwarder
  public
  
  
  
  class
  JUnitToInvocationResultForwarder
  
    extends Object
  
  
  
  
  
      implements
      
        TestListener
      
  
  
  
    
    | java.lang.Object | 
  
  
    
      | ↳ | com.android.tradefed.result.JUnitToInvocationResultForwarder | 
  
  
    
  A class that listens to TestListener events and forwards them to an
 ITestInvocationListener.
 
Summary
| Public methods | 
|---|
  
  
  
    | 
        
        
        
        
        
        void | 
      addError(Test test, Throwable t)
      
        
    
 | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      addFailure(Test test, AssertionFailedError t)
      
        
    
 | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      endTest(Test test,  metrics)
      Callback from JUnit3 tests that can forward metrics.
        
    
 | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      endTest(Test test)
      
        
    
 | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      startTest(Test test)
      
        
    
 | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)
      Callback from JUnit3 forwarder in order to get the logs from a test.
        
    
 | 
  
Public constructors
    JUnitToInvocationResultForwarder
    
public JUnitToInvocationResultForwarder (ITestInvocationListener invocationListener)
    
    
    
  
    
    | Parameters | 
|---|
      
        | invocationListener | ITestInvocationListener | 
    
 
    JUnitToInvocationResultForwarder
    
public JUnitToInvocationResultForwarder ( invocationListeners)
    
    
    
  
    
    | Parameters | 
|---|
      
        | invocationListeners |  | 
    
 
Public methods
    addError
    
public void addError (Test test, 
                Throwable t)
    
    
    
  
    
    | Parameters | 
|---|
      
        | test | Test | 
      
        | t | Throwable | 
    
 
    addFailure
    
public void addFailure (Test test, 
                AssertionFailedError t)
    
    
    
  
    
    | Parameters | 
|---|
      
        | test | Test | 
      
        | t | AssertionFailedError | 
    
 
    endTest
    
public void endTest (Test test, 
                 metrics)
    
    
    
  Callback from JUnit3 tests that can forward metrics.
    
    | Parameters | 
|---|
      
        | test | Test: TheTestthat just finished running. | 
      
        | metrics | : The metrics in a Map format to be passed to the results callback. | 
    
 
    endTest
    
public void endTest (Test test)
    
    
    
  
    
 
    startTest
    
public void startTest (Test test)
    
    
    
  
    
 
    
    
public void testLog (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream)
    
    
    
  Callback from JUnit3 forwarder in order to get the logs from a test.
    
    | Parameters | 
|---|
      
        | dataName | String: a String descriptive name of the data. e.g. "device_logcat". Note dataName
     may not be unique per invocation. ie implementers must be able to handle multiple calls
     with same dataName | 
      
        | dataType | LogDataType: the LogDataType of the data | 
      
        | dataStream | InputStreamSource: the InputStreamSource of the data. Implementers should call
     createInputStream to start reading the data, and ensure to close the resulting
     InputStream when complete. Callers should ensure the source of the data remains present
     and accessible until the testLog method completes. | 
    
 
 
 
  
  
 
  
    
    
      
    
    
  
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2023-03-08 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-03-08 UTC."],[],[]]