コード例 #1
0
    def test_multi_case_multi_scenario_filter_no_topo(self):

        lm = LogManager(root_dir="test-logs")
        tsm = TestSystemManager(None, None, log_manager=lm)
        tsm.configure_logging(debug=True)

        tsm.add_test(SampleTestCase)
        tsm.add_test(SampleOtherTestCase)

        results = tsm.run_all_tests([SampleOtherTestScenario])

        self.assertNotIn(SampleTestScenario, results)
        self.assertIn(SampleOtherTestScenario, results)

        self.assertEqual(2, results[SampleOtherTestScenario].testsRun)
        self.assertEqual(1, len(results[SampleOtherTestScenario].failures))
        self.assertEqual(1, len(results[SampleOtherTestScenario].successes))
        self.assertEqual(0, len(results[SampleOtherTestScenario].errors))
コード例 #2
0
    def test_multi_case_multi_scenario_no_filter_no_topo(self):

        lm = LogManager(root_dir="test-logs")
        tsm = TestSystemManager(None, None, log_manager=lm)
        tsm.configure_logging(debug=True)

        tsm.add_test(SampleTestCase)
        tsm.add_test(SampleOtherTestCase)

        results = tsm.run_all_tests()

        self.assertIn(SampleTestScenario, results)
        self.assertIn(SampleOtherTestScenario, results)

        self.assertEqual(4, results[SampleTestScenario].testsRun)
        self.assertEqual(2, len(results[SampleTestScenario].failures))
        self.assertEqual(2, len(results[SampleTestScenario].successes))
        self.assertEqual(0, len(results[SampleTestScenario].errors))

        self.assertEqual(2, results[SampleOtherTestScenario].testsRun)
        self.assertEqual(1, len(results[SampleOtherTestScenario].failures))
        self.assertEqual(1, len(results[SampleOtherTestScenario].successes))
        self.assertEqual(0, len(results[SampleOtherTestScenario].errors))

        for s in results.iterkeys():
            print "========================================"
            print "Scenario [" + s.__name__ + "]"
            print "Passed [{0}/{1}]".format(len(results[s].successes), results[s].testsRun)
            print "Failed [{0}/{1}]".format(len(results[s].failures), results[s].testsRun)
            print "Error [{0}/{1}]".format(len(results[s].errors), results[s].testsRun)
            print ""
            for tc, err in results[s].failures:
                print "------------------------------"
                print "Test Case FAILED: [" + tc._get_name() + "]"
                print "Failure Message:"
                print err

            for tc, err in results[s].errors:
                print "------------------------------"
                print "Test Case ERROR: [" + tc._get_name() + "]"
                print "Error Message:"
                print err
コード例 #3
0
ファイル: tsm-run.py プロジェクト: danielmellado/zephyr
    console_log.debug('Setting up TSM')
    tsm = TestSystemManager(ptm, vtm, log_manager=log_manager)
    tsm.configure_logging(debug=debug)

    scenario_filters = [TestScenario.get_class(s) for s in scenario_filter_list] \
        if len(scenario_filter_list) != 0 else None
    test_cases = map(TestCase.get_class, tests)

    console_log.debug('Test Case Classes = ' + str(test_cases))

    # Run test cases, possibly filtered on scenarios
    tsm.load_tests(test_cases)

    console_log.debug('Running all tests with scenario filter: ' + str(scenario_filters))

    results = tsm.run_all_tests(scenario_filters)

    for s, tr in results.iteritems():
        print '========================================'
        print 'Scenario [' + s.__name__ + ']'
        print 'Passed [{0}/{1}]'.format(len(results[s].successes), results[s].testsRun)
        print 'Failed [{0}/{1}]'.format(len(results[s].failures), results[s].testsRun)
        print 'Error [{0}/{1}]'.format(len(results[s].errors), results[s].testsRun)
        print ''
        for tc, err in results[s].failures:
            print '------------------------------'
            print 'Test Case FAILED: [' + tc._get_name() + ']'
            print 'Failure Message:'
            print err

        for tc, err in results[s].errors: