public class

TestRunFinishedEvent

extends TestRunEvent

 java.lang.Object

androidx.test.services.events.run.TestRunEvent

↳androidx.test.services.events.run.TestRunFinishedEvent

Gradle dependencies

compile group: 'androidx.test', name: 'runner', version: '1.6.2'

  • groupId: androidx.test
  • artifactId: runner
  • version: 1.6.2

Artifact androidx.test:runner:1.6.2 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.test:runner com.android.support.test:runner

Overview

Denotes that the test ended with a TEST_RUN_FINISHED event.

Summary

Fields
public final intcount

public final java.util.List<FailureInfo>failures

public final intignoreCount

public final longrunTime

from TestRunEventCREATOR
Constructors
publicTestRunFinishedEvent(int count, int ignoreCount, long runTime, java.util.List<FailureInfo> failures)

Creates a TestRunFinishedEvent.

Methods
public voidwriteToParcel(Parcel parcel, int i)

from TestRunEventdescribeContents
from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

public final int count

public final int ignoreCount

public final long runTime

public final java.util.List<FailureInfo> failures

Constructors

public TestRunFinishedEvent(int count, int ignoreCount, long runTime, java.util.List<FailureInfo> failures)

Creates a TestRunFinishedEvent.

Parameters:

count: total number of tests run
ignoreCount: the number of tests ignored during the run
runTime: the number of milliseconds it took to run the entire suite to run
failures: the tests that failed

Methods

public void writeToParcel(Parcel parcel, int i)

Source

/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.test.services.events.run;

import static androidx.test.internal.util.Checks.checkNotNull;

import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.test.services.events.FailureInfo;
import java.util.ArrayList;
import java.util.List;

/**
 * Denotes that the test ended with a TEST_RUN_FINISHED event.
 *
 * @hide
 */
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class TestRunFinishedEvent extends TestRunEvent {
  public final int count;
  public final int ignoreCount;
  public final long runTime;
  @NonNull public final List<FailureInfo> failures;

  /**
   * Creates a {@link TestRunFinishedEvent}.
   *
   * @param count total number of tests run
   * @param ignoreCount the number of tests ignored during the run
   * @param runTime the number of milliseconds it took to run the entire suite to run
   * @param failures the tests that failed
   */
  public TestRunFinishedEvent(
      int count, int ignoreCount, long runTime, @NonNull List<FailureInfo> failures) {
    checkNotNull(failures, "failures cannot be null");
    this.count = count;
    this.ignoreCount = ignoreCount;
    this.runTime = runTime;
    this.failures = failures;
  }

  TestRunFinishedEvent(Parcel source) {
    count = source.readInt();
    ignoreCount = source.readInt();
    runTime = source.readLong();
    this.failures = new ArrayList<>();
    Parcelable[] failures = source.readParcelableArray(FailureInfo[].class.getClassLoader());
    for (Object failure : failures) {
      this.failures.add((FailureInfo) failure);
    }
  }

  @Override
  public void writeToParcel(Parcel parcel, int i) {
    super.writeToParcel(parcel, i);
    parcel.writeInt(count);
    parcel.writeInt(ignoreCount);
    parcel.writeLong(runTime);
    parcel.writeParcelableArray(failures.toArray(new FailureInfo[0]), i);
  }

  @Override
  EventType instanceType() {
    return EventType.FINISHED;
  }
}