Exemple #1
0
 def update(self, tests):
   """Updates the scoreboard with a list of TestMethodResults."""
   for test in tests:
     self._register_test(test.name)
     expect = self._expectations[test.name]
     if test and test.passed:
       result = scoreboard_constants.EXPECTED_PASS
     else:
       result = scoreboard_constants.EXPECTED_FAIL
     actual = self._determine_actual_status(result, expect)
     self._set_result(test.name, actual)
     self._complete_count += 1
     suite_results.report_update_test(self, test.name, actual, test.duration)
Exemple #2
0
  def _finalize_test(self, name, expect):
    assert self._is_valid_expectation(expect)

    if expect in [self._SHOULD_PASS, self._SHOULD_FAIL]:
      # This test was never started, so record and report it as being skipped.
      if name not in self._results:
        self._set_result(name, scoreboard_constants.SKIPPED)
        # We are officially marking the test completed so that the total
        # tests adds up correctly.
        self._complete_count += 1
        suite_results.report_update_test(
            self, name, scoreboard_constants.SKIPPED)
      # This test had no chance to start, or was started but never completed.
      # Report it as incomplete.
      elif self._results[name] == scoreboard_constants.INCOMPLETE:
        suite_results.report_update_test(
            self, name, scoreboard_constants.INCOMPLETE)
    # This test was expected to be skipped and we have no results (ie. it
    # really was skipped) so record and report it as such.  Note: It is
    # possible for tests that were expected to be skipped to be run.  See
    # comment about TIMEOUT above.
    elif expect == self._SHOULD_SKIP and name not in self._results:
      self._set_result(name, scoreboard_constants.SKIPPED)
      suite_results.report_update_test(self, name, scoreboard_constants.SKIPPED)
    # This flaky test never successfully passed, so record and report it as
    # a failure.
    elif (expect == self._MAYBE_FLAKY and
          self._results.get(name) == scoreboard_constants.EXPECTED_FLAKE):
      self._set_result(name, scoreboard_constants.UNEXPECTED_FAIL)
      suite_results.report_update_test(
          self, name, scoreboard_constants.UNEXPECTED_FAIL)
    elif (expect == self._MAYBE_FLAKY and
          self._results.get(name) == scoreboard_constants.INCOMPLETE):
      self._set_result(name, scoreboard_constants.INCOMPLETE)
      suite_results.report_update_test(
          self, name, scoreboard_constants.INCOMPLETE)