Exemplo n.º 1
0
class TestCriticality(unittest.TestCase):

    def setUp(self):
        self.suite = TestSuite()
        self.sub = self.suite.suites.create()

    def test_default_criticality(self):
        self._verify_criticality(self.suite, [], [])
        self._verify_criticality(self.sub, [], [])

    def test_set_criticality(self):
        self.suite.set_criticality(['c1', 'c2'], 'non')
        self._verify_criticality(self.suite, ['c1', 'c2'], ['non'])
        self._verify_criticality(self.sub, ['c1', 'c2'], ['non'])

    def test_cannot_set_criticality_for_child_suites(self):
        assert_raises(TypeError, self.sub.set_criticality)

    def test_criticality_set_for_child_suites_earlier_is_ignored(self):
        self.suite.set_criticality('use', 'us')
        sub2 = TestSuite()
        sub2.set_criticality('ignore', 'these')
        self.suite.suites.append(sub2)
        self._verify_criticality(self.suite, ['use'], ['us'])
        self._verify_criticality(self.sub, ['use'], ['us'])
        self._verify_criticality(sub2, ['use'], ['us'])

    def _verify_criticality(self, suite, crit, non_crit):
        assert_equal([unicode(t) for t in suite.criticality.critical_tags], crit)
        assert_equal([unicode(t) for t in suite.criticality.non_critical_tags], non_crit)
Exemplo n.º 2
0
class TestCriticality(unittest.TestCase):
    def setUp(self):
        self.suite = TestSuite()
        self.sub = self.suite.suites.create()

    def test_default_criticality(self):
        self._verify_criticality(self.suite, [], [])
        self._verify_criticality(self.sub, [], [])

    def test_set_criticality(self):
        self.suite.set_criticality(['c1', 'c2'], 'non')
        self._verify_criticality(self.suite, ['c1', 'c2'], ['non'])
        self._verify_criticality(self.sub, ['c1', 'c2'], ['non'])

    def test_cannot_set_criticality_for_child_suites(self):
        assert_raises(TypeError, self.sub.set_criticality)

    def test_criticality_set_for_child_suites_earlier_is_ignored(self):
        self.suite.set_criticality('use', 'us')
        sub2 = TestSuite()
        sub2.set_criticality('ignore', 'these')
        self.suite.suites.append(sub2)
        self._verify_criticality(self.suite, ['use'], ['us'])
        self._verify_criticality(self.sub, ['use'], ['us'])
        self._verify_criticality(sub2, ['use'], ['us'])

    def _verify_criticality(self, suite, crit, non_crit):
        assert_equal([unicode(t) for t in suite.criticality.critical_tags],
                     crit)
        assert_equal([unicode(t) for t in suite.criticality.non_critical_tags],
                     non_crit)
Exemplo n.º 3
0
 def test_criticality_set_for_child_suites_earlier_is_ignored(self):
     self.suite.set_criticality('use', 'us')
     sub2 = TestSuite()
     sub2.set_criticality('ignore', 'these')
     self.suite.suites.append(sub2)
     self._verify_criticality(self.suite, ['use'], ['us'])
     self._verify_criticality(self.sub, ['use'], ['us'])
     self._verify_criticality(sub2, ['use'], ['us'])
Exemplo n.º 4
0
 def test_criticality_set_for_child_suites_earlier_is_ignored(self):
     self.suite.set_criticality('use', 'us')
     sub2 = TestSuite()
     sub2.set_criticality('ignore', 'these')
     self.suite.suites.append(sub2)
     self._verify_criticality(self.suite, ['use'], ['us'])
     self._verify_criticality(self.sub, ['use'], ['us'])
     self._verify_criticality(sub2, ['use'], ['us'])
Exemplo n.º 5
0
 def test_critical_with_parent(self):
     suite = TestSuite()
     assert_equal(suite.tests.create().critical, True)
     suite.set_criticality(critical_tags=['crit'])
     assert_equal(suite.tests.create().critical, False)
     assert_equal(suite.tests.create(tags=['crit']).critical, True)