Beispiel #1
0
  @Test
  public void runTests() {
    final ImmutableList<String> command = ImmutableList.of("hello", "world");

    FakeCxxTest cxxTest =
        new FakeCxxTest() {

          @Override
          protected ImmutableList<String> getShellCommand(ExecutionContext context, Path output) {
            return command;
          }
        };

    BuildContext buildContext = FakeBuildContext.NOOP_CONTEXT;
    ExecutionContext executionContext = TestExecutionContext.newInstance();
    TestRunningOptions options =
        TestRunningOptions.builder()
            .setDryRun(false)
            .setTestSelectorList(TestSelectorList.empty())
            .build();
    ImmutableList<Step> actualSteps =
        cxxTest.runTests(
            buildContext, executionContext, options, FakeTestRule.NOOP_REPORTING_CALLBACK);

    CxxTestStep cxxTestStep =
        new CxxTestStep(
            new FakeProjectFilesystem(),
            command,
            ImmutableMap.<String, String>of(),
            cxxTest.getPathToTestExitCode(),
            cxxTest.getPathToTestOutput(),
            TEST_TIMEOUT_MS);

    assertEquals(cxxTestStep, Iterables.getLast(actualSteps));
  }
Beispiel #2
0
  @Test
  public void startAndStopShouldRelateProperlyBasedOnHash() {
    ImmutableSet<String> tests = ImmutableSet.of("//exmaple:other", "//thing/made/of:cheese");

    TestRunEvent.Started started =
        TestRunEvent.started(false, TestSelectorList.empty(), false, tests);
    TestRunEvent.Finished finished = TestRunEvent.finished(tests, ImmutableList.<TestResults>of());

    assertTrue(started.isRelatedTo(finished));
    assertTrue(finished.isRelatedTo(started));
  }
Beispiel #3
0
  @Test
  public void shouldNotBelieveThatEventsThatAreNotRelatedAreRelated() {
    ImmutableSet<String> tests = ImmutableSet.of("//exmaple:other", "//thing/made/of:cheese");
    ImmutableSet<String> otherTests = ImmutableSet.of("//example:test");

    TestRunEvent.Started started =
        TestRunEvent.started(false, TestSelectorList.empty(), false, tests);
    TestRunEvent.Finished finished =
        TestRunEvent.finished(otherTests, ImmutableList.<TestResults>of());

    assertFalse(started.isRelatedTo(finished));
    assertFalse(finished.isRelatedTo(started));
  }