def setUp(self): self.__jenkins = FakeJenkinsTestReport() self.__subject = FakeSubject( metric_source_ids={self.__jenkins: 'jenkins_job'}) self.__project = domain.Project( metric_sources={metric_source.SystemTestReport: self.__jenkins}) self.__metric = metric.FailingRegressionTests(subject=self.__subject, project=self.__project)
def test_value_multiple_jobs(self): """ Test that the value of the metric equals to total number of failing tests if there are multiple test reports. """ subject = FakeSubject(metric_source_ids={self.__jenkins: ['a', 'b']}) failing_tests = metric.FailingRegressionTests(subject=subject, project=self.__project) expected = self.__jenkins.failed_tests( 'a', 'b') + self.__jenkins.skipped_tests('a', 'b') self.assertEqual(expected, failing_tests.value())
def test_missing_metric_source(self): """ Test the metric without a metric source. """ failing_tests = metric.FailingRegressionTests(subject=domain.Product(), project=self.__project) self.assertTrue(failing_tests._missing()) self.assertEqual('?', failing_tests._parameters()['tests'])