Ejemplo n.º 1
0
 def test_nested_structure(self):
     suite = TestSuite()
     suite.keywords = [Keyword(type='setup'), Keyword(type='teardown')]
     K1 = self._verify_keyword(suite.keywords[0], type=1)
     K2 = self._verify_keyword(suite.keywords[1], type=2)
     suite.suites = [TestSuite()]
     suite.suites[0].tests = [TestCase(tags=['crit', 'xxx'])]
     t = self._verify_test(suite.suites[0].tests[0], tags=('crit', 'xxx'))
     suite.tests = [TestCase(), TestCase(status='PASS')]
     S1 = self._verify_suite(suite.suites[0],
                             status=0, tests=(t,), stats=(1, 0, 1))
     suite.tests[0].keywords = [Keyword(type=Keyword.FOR_LOOP_TYPE), Keyword()]
     suite.tests[0].keywords[0].keywords = [Keyword(type=Keyword.FOR_ITEM_TYPE)]
     suite.tests[0].keywords[0].messages = [Message()]
     k = self._verify_keyword(suite.tests[0].keywords[0].keywords[0], type=4)
     m = self._verify_message(suite.tests[0].keywords[0].messages[0])
     k1 = self._verify_keyword(suite.tests[0].keywords[0],
                               type=3, keywords=(k,), messages=(m,))
     suite.tests[0].keywords[1].messages = [Message(), Message('msg', level='TRACE')]
     m1 = self._verify_message(suite.tests[0].keywords[1].messages[0])
     m2 = self._verify_message(suite.tests[0].keywords[1].messages[1], 'msg', level=0)
     k2 = self._verify_keyword(suite.tests[0].keywords[1], messages=(m1, m2))
     T1 = self._verify_test(suite.tests[0], keywords=(k1, k2))
     T2 = self._verify_test(suite.tests[1], status=1)
     self._verify_suite(suite, status=0, keywords=(K1, K2), suites=(S1,),
                        tests=(T1, T2), stats=(3, 1, 2))
     self._verify_min_message_level('TRACE')
 def test_id_with_keyword_parents(self):
     kw = TestSuite().tests.create().keywords.create()
     kw.keywords = [Keyword(), Keyword()]
     kw.keywords[-1].keywords.create()
     assert_equal(kw.keywords[0].id, 's1-t1-k1-k1')
     assert_equal(kw.keywords[1].id, 's1-t1-k1-k2')
     assert_equal(kw.keywords[1].keywords[0].id, 's1-t1-k1-k2-k1')
 def test_nested_structure(self):
     suite = TestSuite()
     suite.set_criticality(critical_tags=['crit'])
     suite.keywords = [Keyword(type='setup'), Keyword(type='teardown')]
     K1 = self._verify_keyword(suite.keywords[0], type=1)
     K2 = self._verify_keyword(suite.keywords[1], type=2)
     suite.suites = [TestSuite()]
     suite.suites[0].tests = [TestCase(tags=['crit', 'xxx'])]
     t = self._verify_test(suite.suites[0].tests[0], tags=('crit', 'xxx'))
     suite.tests = [TestCase(), TestCase(status='PASS')]
     S1 = self._verify_suite(suite.suites[0],
                             status=0, tests=(t,), stats=(1, 0, 1, 0))
     suite.tests[0].keywords = [Keyword(type=Keyword.FOR_LOOP_TYPE), Keyword()]
     suite.tests[0].keywords[0].keywords = [Keyword(type=Keyword.FOR_ITEM_TYPE)]
     suite.tests[0].keywords[0].messages = [Message()]
     k = self._verify_keyword(suite.tests[0].keywords[0].keywords[0], type=4)
     m = self._verify_message(suite.tests[0].keywords[0].messages[0])
     k1 = self._verify_keyword(suite.tests[0].keywords[0],
                               type=3, keywords=(k,), messages=(m,))
     suite.tests[0].keywords[1].messages = [Message(), Message('msg', level='TRACE')]
     m1 = self._verify_message(suite.tests[0].keywords[1].messages[0])
     m2 = self._verify_message(suite.tests[0].keywords[1].messages[1], 'msg', level=0)
     k2 = self._verify_keyword(suite.tests[0].keywords[1], messages=(m1, m2))
     T1 = self._verify_test(suite.tests[0], critical=0, keywords=(k1, k2))
     T2 = self._verify_test(suite.tests[1], critical=0, status=1)
     self._verify_suite(suite, status=0, keywords=(K1, K2), suites=(S1,),
                        tests=(T1, T2), stats=(3, 1, 1, 0))
     self._verify_min_message_level('TRACE')
 def _get_suite_with_keywords(self):
     suite = TestSuite(name='root')
     suite.keywords = [
         Keyword('k1', type='setup'),
         Keyword('k2', type='teardown')
     ]
     suite.keywords[0].keywords = [Keyword('k1-k2')]
     return suite
 def _get_suite_with_keywords(self):
     suite = TestSuite(name='root')
     suite.keywords = [Keyword('k1', type='setup'), Keyword('k2', type='teardown')]
     suite.keywords[0].keywords = [Keyword('k1-k2')]
     return suite