def suite(): """Define all the tests of the module.""" suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(CreateV1TestCase)) return suite
def test_suite(): suite = unittest.TestSuite() for test in tests: suite.addTest(unittest.makeSuite(test)) return suite
def suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(AuctionCancellationDocumentResourceTest)) suite.addTest(unittest.makeSuite(AuctionCancellationResourceTest)) return suite
('84983e441c3bd26ebaae4aa1f95129e5e54670f1', 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'), # FIPS PUB 180-2, A.3 - "Long Message" # ('34aa973cd4c4daa4f61eeb2bdbad27316534016f', # 'a' * 10**6, # '"a" * 10**6'), # RFC 3174: Section 7.3, "TEST4" (multiple of 512 bits) ('dea356a2cddd90c7a7ecedc5ebb563934f460452', '01234567' * 80, '"01234567" * 80'), ] def get_tests(config={}): from Crypto.Hash import SHA from common import make_hash_tests return make_hash_tests(SHA, "SHA", test_data, digest_size=20, oid="\x06\x05\x2B\x0E\x03\x02\x1A") if __name__ == '__main__': import unittest suite = lambda: unittest.TestSuite(get_tests()) unittest.main(defaultTest='suite') # vim:set ts=4 sw=4 sts=4 expandtab:
def runTests(): mySuite = unittest.TestSuite([module.getSuite() for module in [ctest, specTest, quadTest, selTest, modTest]]) unittest.TextTestRunner(verbosity=2).run(mySuite)
def test_suite(level=1): suites = [] if level > 0: suites.append( unittest.makeSuite(test_agg,'check_') ) total_suite = unittest.TestSuite(suites) return total_suite
def test_suite(): return unittest.TestSuite(( unittest.makeSuite(UrsineGlobalsTests), ))
from unittest import * import unittest from SeleniumAutomation.Reports import HTMLTestRunner from SeleniumAutomation.TestCases.Test_Retail_Login import * if __name__ == '__main__': loader = unittest.TestLoader() suite = unittest.TestSuite(( loader.loadTestsFromTestCase(Test_Retail_Login))) outfile = open('Report.html', 'w') runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, verbosity=1, title='LinkedIn Report', description='This is a demo report') runner.run(suite)
def test_suite(): suite = unittest.TestSuite() flags = (doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS) checker = RENormalizing([ # python 3 drops the u" prefix on unicode strings (re.compile(r"u('[^']*')"), r"\1"), # python 3 includes module name in exceptions (re.compile(r"crate.client.exceptions.ProgrammingError:"), "ProgrammingError:"), (re.compile(r"crate.client.exceptions.ConnectionError:"), "ConnectionError:"), (re.compile(r"crate.client.exceptions.DigestNotFoundException:"), "DigestNotFoundException:"), (re.compile(r"crate.client.exceptions.BlobLocationNotFoundException:"), "BlobLocationNotFoundException:"), (re.compile(r"<type "), "<class "), ]) s = doctest.DocFileSuite( 'cursor.txt', 'connection.txt', checker=checker, setUp=setUpMocked, optionflags=flags, encoding='utf-8' ) suite.addTest(s) suite.addTest(unittest.makeSuite(CursorTest)) suite.addTest(unittest.makeSuite(HttpClientTest)) suite.addTest(unittest.makeSuite(KeepAliveClientTest)) suite.addTest(unittest.makeSuite(ThreadSafeHttpClientTest)) suite.addTest(unittest.makeSuite(ParamsTest)) suite.addTest(unittest.makeSuite(ConnectionTest)) suite.addTest(unittest.makeSuite(RetryOnTimeoutServerTest)) suite.addTest(unittest.makeSuite(RequestsCaBundleTest)) suite.addTest(unittest.makeSuite(TestUsernameSentAsHeader)) suite.addTest(sqlalchemy_test_suite()) suite.addTest(doctest.DocTestSuite('crate.client.connection')) suite.addTest(doctest.DocTestSuite('crate.client.http')) s = doctest.DocFileSuite( '../../../docs/https.txt', checker=checker, setUp=setUpWithHttps, optionflags=flags, encoding='utf-8' ) s.layer = HttpsTestServerLayer() suite.addTest(s) s = doctest.DocFileSuite( 'sqlalchemy/itests.txt', 'sqlalchemy/dialect.txt', 'sqlalchemy/reflection.txt', checker=checker, setUp=setUpCrateLayerAndSqlAlchemy, tearDown=tearDownWithCrateLayer, optionflags=flags, encoding='utf-8' ) s.layer = crate_layer suite.addTest(s) s = doctest.DocFileSuite( 'http.txt', 'blob.txt', '../../../docs/client.txt', '../../../docs/advanced_usage.txt', '../../../docs/blobs.txt', checker=checker, setUp=setUpWithCrateLayer, tearDown=tearDownWithCrateLayer, optionflags=flags, encoding='utf-8' ) s.layer = crate_layer suite.addTest(s) s = doctest.DocFileSuite( '../../../docs/sqlalchemy.txt', checker=checker, setUp=setUpCrateLayerAndSqlAlchemy, tearDown=tearDownWithCrateLayer, optionflags=flags, encoding='utf-8' ) s.layer = crate_layer suite.addTest(s) return suite
def suite(): return unittest.TestSuite((unittest.makeSuite(CCMiscTests, 'test'), unittest.makeSuite(CommonCartridgeTests, 'test'), unittest.makeSuite(CCConformanceTests, 'test')))
def test_suite(): return unittest.TestSuite((unittest.makeSuite(Tests), ))
def test_suite(): marshaler = doctest.DocFileSuite('../marshaler.rst', optionflags=doctest.ELLIPSIS) marshaler.layer = UnitTestLayer return unittest.TestSuite((marshaler, ))
def suite(): return unittest.TestSuite((unittest.makeSuite(Test_chisquare2way)))
import unittest import HtmlTestRunner import os from login import Login dir = os.getcwd() Login_testcase = unittest.TestLoader().loadTestsFromTestCase(Login) test_suite = unittest.TestSuite([Login_testcase]) outfile = open(dir + '\LoginTestSummary.html', 'w') runner = HtmlTestRunner.HTMLTestRunner( stream=outfile, report_title='Test Report', descriptions='Testing', ) runner.run(test_suite)
def test_suite(): return unittest.TestSuite(( unittest.makeSuite(PortalContentTests), unittest.makeSuite(TestContentCopyPaste), ))
def create_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(tester_t)) return suite
def suite(): return unittest.TestSuite(get_tests())
def simpleSuite(): suiteSelect = unittest.TestSuite() suiteSelect.addTest(PdbxReaderTests("testReadBigDataFile")) suiteSelect.addTest(PdbxReaderTests("testReadSmallDataFile")) suiteSelect.addTest(PdbxReaderTests("testReadSFDataFile")) return suiteSelect
def Run(project_config, test_run_options, args): binary_manager.InitDependencyManager(project_config.client_configs) parser = argparse.ArgumentParser(description='Run a browser test suite') parser.add_argument('test', type=str, help='Name of the test suite to run') parser.add_argument( '--write-abbreviated-json-results-to', metavar='FILENAME', action='store', help=('If specified, writes the full results to that path in json form.')) parser.add_argument('--test-filter', type=str, default='', action='store', help='Run only tests whose names match the given filter regexp.') parser.add_argument('--total-shards', default=1, type=int, help='Total number of shards being used for this test run. (The user of ' 'this script is responsible for spawning all of the shards.)') parser.add_argument('--shard-index', default=0, type=int, help='Shard index (0..total_shards-1) of this test run.') parser.add_argument( '--filter-tests-after-sharding', default=False, action='store_true', help=('Apply the test filter after tests are split for sharding. Useful ' 'for reproducing bugs related to the order in which tests run.')) parser.add_argument( '--read-abbreviated-json-results-from', metavar='FILENAME', action='store', help=( 'If specified, reads abbreviated results from that path in json form. ' 'The file format is that written by ' '--write-abbreviated-json-results-to. This information is used to more ' 'evenly distribute tests among shards.')) parser.add_argument('--debug-shard-distributions', action='store_true', default=False, help='Print debugging information about the shards\' test distributions') option, extra_args = parser.parse_known_args(args) for start_dir in project_config.start_dirs: modules_to_classes = discover.DiscoverClasses( start_dir, project_config.top_level_dir, base_class=serially_executed_browser_test_case. SeriallyExecutedBrowserTestCase) browser_test_classes = modules_to_classes.values() _ValidateDistinctNames(browser_test_classes) test_class = None for cl in browser_test_classes: if cl.Name() == option.test: test_class = cl break if not test_class: print 'Cannot find test class with name matching %s' % option.test print 'Available tests: %s' % '\n'.join( cl.Name() for cl in browser_test_classes) return 1 options = ProcessCommandLineOptions(test_class, project_config, extra_args) test_times = None if option.read_abbreviated_json_results_from: with open(option.read_abbreviated_json_results_from, 'r') as f: abbr_results = json.load(f) test_times = abbr_results.get('times') suite = unittest.TestSuite() for test in _LoadTests(test_class, options, option.test_filter, option.filter_tests_after_sharding, option.total_shards, option.shard_index, test_times, option.debug_shard_distributions): suite.addTest(test) results = unittest.TextTestRunner( verbosity=test_run_options.verbosity, resultclass=BrowserTestResult).run(suite) if option.write_abbreviated_json_results_to: with open(option.write_abbreviated_json_results_to, 'w') as f: json_results = {'failures': [], 'successes': [], 'times': {}, 'valid': True} # Treat failures and errors identically in the JSON # output. Failures are those which cooperatively fail using # Python's unittest APIs; errors are those which abort the test # case early with an execption. failures = [] for fail, _ in results.failures + results.errors: # When errors in thrown in individual test method or setUp or tearDown, # fail would be an instance of unittest.TestCase. if isinstance(fail, unittest.TestCase): failures.append(fail.shortName()) else: # When errors in thrown in setupClass or tearDownClass, an instance of # _ErrorHolder is is placed in results.errors list. We use the id() # as failure name in this case since shortName() is not available. failures.append(fail.id()) failures = sorted(list(failures)) for failure_id in failures: json_results['failures'].append(failure_id) for passed_test_case in results.successes: json_results['successes'].append(passed_test_case.shortName()) json_results['times'].update(results.times) json.dump(json_results, f) return len(results.failures + results.errors)
def get_suite(): """ Create an instance of the test suite for RS485 emulator tests """ suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(Rs485EndpointsTestCase)) return suite
def test_suite(): return unittest.TestSuite(( DocTestSuite('ZODB.broken'), DocTestSuite(), ))
################################## from Login_and_Accounts import * from Service_Offering import * from TemplatesAndISO import * from VM_lifeCycle import * ################################### # Following are BVT Tests # serialize the test cases suite = unittest.TestSuite() # setup new test suite #################################################################################################### # Following logs admin user in and creates test account then logs admin user out and logs in as test to run tests. # You should leave this as is for all the tests. suite.addTest(unittest.makeSuite(login)) #Login Admin time.sleep(5) suite.addTest(unittest.makeSuite(createAcc)) # Create an Account test. We will use test account for all our tests time.sleep(5) suite.addTest(unittest.makeSuite(logout)) #Logout Admin
def run_tests(): from tests.network_test import network_test_suite tests = unittest.TestSuite((network_test_suite())) unittest.TextTestRunner(verbosity=1).run(tests)
relative = root[relative_start:] pkg = relative.replace(os.sep,'.') base = os.path.splitext(file_name)[0:-1][0] if (base == "__init__"): continue if len(pkg) > 0: module_name = pkg + "." + base else: module_name = base module_names.append(module_name) for module_name in module_names: try: module = __import__(module_name, globals(), locals(), module_name) test_modules.append(module) except: # No complaints - just test the files we can (user may have run # test project on an unfinished project where not all files are valid) pass suite = unittest.TestSuite(map(unittest.defaultTestLoader.loadTestsFromModule, test_modules)) # Doctest for module in test_modules: try: suite.addTest(doctest.DocTestSuite(module)) except ValueError, e: # doctest will raise ValueError(module, "has no tests") # and we're trying this on random modules: No loud complaints! pass # Run all the tests _NetBeansTestRunner().run(suite)
def setUp(self): print("用例执行开始前,执行该语句") @classmethod def tearDownClass(self): print("程序执行完成后,执行该语句") @classmethod def setUpClass(self): print("程序执行开始前,执行该语句") def test_a_run(self): self.assertEqual(1, 1) def test_b_run(self): self.assertNotEqual(1, 2) def test_c_run(self): self.assertTrue(2 > 1) def test_d_run(self): self.assertIsNotNone(1) if __name__ == "__main__": test_suit = unittest.TestSuite() #test_suit.addTest(MyTest("test_a_run")) test_suit.addTest(unittest.makeSuite(MyTest)) with open("demo2.html", "wb") as fp: runner = HTMLTestRunner(stream = fp, title = "API测试报告", description = "测试情况") runner.run(test_suit)
def suite(): regression_suite = unittest.makeSuite(RegressionTests, "Check") return unittest.TestSuite((regression_suite, ))
def suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(PlanArchivariusResourceTest)) return suite
ie.setMinEpsilonRate(0.001) msg = self.iterTest(proto, ie, self.w, {'s': 0, 'c': 0}) if msg is not None: self.fail(msg) def WikipediaExample(self): protoie = gum.LazyPropagation(self.bn2) protoie.makeInference() proto = protoie.posterior('w2') ie = gum.LoopyWeightedSampling(self.bn2) ie.setVerbosity(False) ie.setEpsilon(0.01) ie.setMinEpsilonRate(0.001) msg = self.iterTest(proto, ie, 'w2', {}) if msg is not None: self.fail(msg) ie2 = gum.LoopyMonteCarloSampling(self.bn2) ie2.setVerbosity(False) ie2.setEpsilon(0.01) ie2.setMinEpsilonRate(0.001) msg = self.iterTest(proto, ie2, 'w2', {}) if msg is not None: self.fail(msg) ts = unittest.TestSuite() addTests(ts, TestDictFeature) addTests(ts, TestInferenceResults)
import unittest from test_b import AndroidTest from HTMLTestRunner import HTMLTestRunner if __name__ == '__main__': suite = unittest.TestSuite() suite.addTests(unittest.TestLoader().loadTestsFromTestCase(AndroidTest)) with open('HTMLReport.html', 'wb') as f: runner = HTMLTestRunner(stream=f, title='喜马拉雅FM', description='测试结果', verbosity=2) runner.run(suite)
def suite(): tests = ['testAnnotation'] return unittest.TestSuite(map(AnnotationTest, tests))