androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner Java Examples

The following examples show how to use androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AndroidJUnit4.java    From android-test with Apache License 2.0 4 votes vote down vote up
/** Constructs a new instance of the default runner */
public AndroidJUnit4(Class<?> klass, AndroidRunnerParams runnerParams)
    throws InitializationError {
  // this is expected to be called when in Android environment.
  delegate = new AndroidJUnit4ClassRunner(klass, runnerParams);
}
 
Example #2
Source File: TestLoaderTest.java    From android-test with Apache License 2.0 4 votes vote down vote up
@Test
public void testLoadTests_junit4() {
  assertLoadTestSuccess(JUnit4Test.class, AndroidJUnit4ClassRunner.class);
}
 
Example #3
Source File: TestLoaderTest.java    From android-test with Apache License 2.0 4 votes vote down vote up
@Test
public void testLoadTests_all() {
  Collection<String> classNames =
      Arrays.asList(
          JUnit3Test.class.getName(),
          EmptyJUnit3Test.class.getName(),
          JUnit4Test.class.getName(),
          JUnit4RunTest.class.getName(),
          NotATest.class.getName(),
          CustomTest.class.getName(),
          "notexist",
          AbstractTest.class.getName(),
          SubClassJUnit4Test.class.getName(),
          SubClassAbstractTest.class.getName());

  List<Runner> runners = loader.getRunnersFor(classNames, false);
  List<Class<? extends Runner>> runnerClasses = new ArrayList<>();
  for (Runner runner : runners) {
    runnerClasses.add(runner == null ? null : runner.getClass());
  }

  List<Class<? extends Runner>> expectedRunnerClasses;
  if (scanningPath) {
    // When scanning path TestLoader is stricter about what it will accept as a test.
    expectedRunnerClasses =
        Arrays.asList(
            JUnit38ClassRunner.class,
            AndroidJUnit4ClassRunner.class,
            ErrorReportingRunner.class,
            UnloadableClassRunner.class,
            AndroidJUnit4ClassRunner.class,
            JUnit38ClassRunner.class);
  } else {
    expectedRunnerClasses =
        Arrays.asList(
            JUnit38ClassRunner.class,
            JUnit38ClassRunner.class,
            AndroidJUnit4ClassRunner.class,
            ErrorReportingRunner.class,
            ErrorReportingRunner.class,
            ErrorReportingRunner.class,
            UnloadableClassRunner.class,
            JUnit38ClassRunner.class,
            AndroidJUnit4ClassRunner.class,
            JUnit38ClassRunner.class);
  }
  assertEquals(expectedRunnerClasses, runnerClasses);
}
 
Example #4
Source File: TestLoaderTest.java    From android-test with Apache License 2.0 4 votes vote down vote up
@Test
public void testLoadTests_junit4SubclassAbstract() {
  assertLoadTestSuccess(SubClassJUnit4Test.class, AndroidJUnit4ClassRunner.class);
}