def _get_suite(self):
     ts = lambda s, ms=0: '20120816 16:09:%02d.%03d' % (s, ms)
     suite = TestSuite(name='root', starttime=ts(0), endtime=ts(42))
     sub1 = TestSuite(name='sub1', starttime=ts(0), endtime=ts(10))
     sub2 = TestSuite(name='sub2')
     suite.suites = [sub1, sub2]
     sub1.tests = [
         TestCase(tags=['t1', 't2'],
                  status='PASS',
                  starttime=ts(0),
                  endtime=ts(1, 500)),
         TestCase(tags=['t1', 't3'],
                  status='FAIL',
                  starttime=ts(2),
                  endtime=ts(3, 499)),
         TestCase(tags=['t3'],
                  status='SKIP',
                  starttime=ts(3, 560),
                  endtime=ts(3, 560))
     ]
     sub2.tests = [
         TestCase(tags=['t1', 't2'],
                  status='PASS',
                  starttime=ts(10),
                  endtime=ts(30))
     ]
     sub2.suites.create(name='below suite stat level')\
             .tests.create(tags=['t1'], status='FAIL', starttime=ts(30), endtime=ts(40))
     return suite
 def _get_suite_with_tests(self):
     suite = TestSuite(name='suite')
     suite.tests = [TestCase('t1'), TestCase('t2')]
     suite.tests[0].keywords = [Keyword('t1-k1'), Keyword('t1-k2')]
     suite.tests[0].keywords[0].keywords = [Keyword('t1-k1-k1')]
     suite.tests[1].keywords = [Keyword('t2-k1')]
     return suite
 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')
Ejemplo n.º 4
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')
Ejemplo n.º 5
0
 def test_nested_structure(self):
     suite = TestSuite()
     suite.setup.config(kwname='setup')
     suite.teardown.config(kwname='td')
     K1 = self._verify_keyword(suite.setup, type=1, kwname='setup')
     K2 = self._verify_keyword(suite.teardown, type=2, kwname='td')
     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].body = [Keyword(type=Keyword.FOR), Keyword()]
     suite.tests[0].body[0].body = [Keyword(type=Keyword.ITERATION), Message()]
     k = self._verify_keyword(suite.tests[0].body[0].body[0], type=4)
     m = self._verify_message(suite.tests[0].body[0].messages[0])
     k1 = self._verify_keyword(suite.tests[0].body[0], type=3, body=(k, m))
     suite.tests[0].body[1].body = [Message(), Message('msg', level='TRACE')]
     m1 = self._verify_message(suite.tests[0].body[1].messages[0])
     m2 = self._verify_message(suite.tests[0].body[1].messages[1], 'msg', level=0)
     k2 = self._verify_keyword(suite.tests[0].body[1], body=(m1, m2))
     T1 = self._verify_test(suite.tests[0], body=(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, 0))
     self._verify_min_message_level('TRACE')
 def _get_suite_with_tests(self):
     suite = TestSuite(name='suite')
     suite.tests = [TestCase('t1'), TestCase('t2')]
     suite.tests[0].keywords = [Keyword('t1-k1'), Keyword('t1-k2')]
     suite.tests[0].keywords[0].keywords = [Keyword('t1-k1-k1')]
     suite.tests[1].keywords = [Keyword('t2-k1')]
     return suite
Ejemplo n.º 7
0
 def setUp(self):
     suite = TestSuite(name='Hello')
     suite.tests = [
         TestCase(status='PASS'),
         TestCase(status='PASS'),
         TestCase(status='FAIL')
     ]
     self.statistics = Statistics(suite)
 def _get_suite(self):
     ts = lambda s, ms=0: '20120816 16:09:%02d.%03d' % (s, ms)
     suite = TestSuite(name='root', starttime=ts(0), endtime=ts(42))
     suite.set_criticality(critical_tags=['t2'])
     sub1 = TestSuite(name='sub1', starttime=ts(0), endtime=ts(10))
     sub2 = TestSuite(name='sub2')
     suite.suites = [sub1, sub2]
     sub1.tests = [
         TestCase(tags=['t1', 't2'], status='PASS', starttime=ts(0), endtime=ts(1, 500)),
         TestCase(tags=['t1', 't3'], status='FAIL', starttime=ts(2), endtime=ts(3, 499))
     ]
     sub2.tests = [
         TestCase(tags=['t1', 't2'], status='PASS', starttime=ts(10), endtime=ts(30))
     ]
     sub2.suites.create(name='below suite stat level')\
             .tests.create(tags=['t1'], status='FAIL', starttime=ts(30), endtime=ts(40))
     return suite
Ejemplo n.º 9
0
 def _create_suite_with_tests(self):
     suite = TestSuite()
     suite.tests = [TestCase(status='PASS'),
                    TestCase(status='PASS', tags='nc'),
                    TestCase(status='PASS'),
                    TestCase(status='FAIL'),
                    TestCase(status='FAIL', tags='nc')]
     return suite
 def _create_suite_with_tests(self):
     suite = TestSuite()
     suite.set_criticality([], ['nc'])
     suite.tests = [TestCase(status='PASS'),
                    TestCase(status='PASS', tags='nc'),
                    TestCase(status='PASS'),
                    TestCase(status='FAIL'),
                    TestCase(status='FAIL', tags='nc')]
     return suite
Ejemplo n.º 11
0
 def test_suite_stats_when_suite_has_no_times(self):
     suite = TestSuite()
     assert_equal(Statistics(suite).suite.stat.elapsed, 0)
     ts = '20120816 00:00:'
     suite.tests = [TestCase(starttime=ts+'00.000', endtime=ts+'00.001'),
                    TestCase(starttime=ts+'00.001', endtime=ts+'01.001')]
     assert_equal(Statistics(suite).suite.stat.elapsed, 1001)
     suite.suites = [TestSuite(starttime=ts+'02.000', endtime=ts+'12.000'),
                     TestSuite()]
     assert_equal(Statistics(suite).suite.stat.elapsed, 11001)
 def test_suite_stats_when_suite_has_no_times(self):
     suite = TestSuite()
     assert_equal(Statistics(suite).suite.stat.elapsed, 0)
     ts = '20120816 00:00:'
     suite.tests = [TestCase(starttime=ts+'00.000', endtime=ts+'00.001'),
                    TestCase(starttime=ts+'00.001', endtime=ts+'01.001')]
     assert_equal(Statistics(suite).suite.stat.elapsed, 1001)
     suite.suites = [TestSuite(starttime=ts+'02.000', endtime=ts+'12.000'),
                     TestSuite()]
     assert_equal(Statistics(suite).suite.stat.elapsed, 11001)
 def setUp(self):
     suite = TestSuite(name='Hello')
     suite.tests = [TestCase(status='PASS'), TestCase(status='PASS'),
                    TestCase(status='FAIL')]
     self.statistics = Statistics(suite)