X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=vstf%2Fvstf%2Fcontroller%2Funittest%2FREADME;fp=vstf%2Fvstf%2Fcontroller%2Funittest%2FREADME;h=0000000000000000000000000000000000000000;hb=07fa6d43cf0ac1baf3cd67e741f474273fbd387d;hp=61ef1a248727e2d12b66274c6df1c4bf6fb5028f;hpb=486719ea0024e683f4e90832e647becf3d5d5ab7;p=bottlenecks.git diff --git a/vstf/vstf/controller/unittest/README b/vstf/vstf/controller/unittest/README deleted file mode 100755 index 61ef1a24..00000000 --- a/vstf/vstf/controller/unittest/README +++ /dev/null @@ -1,45 +0,0 @@ - - -the procedure to integrate a module unit testing into the unit testing framework: - -1.create your own unit test module, the name should start by 'test', for example, test_env.py - -2.create the test cases inside the module, inherit unittest.TestCase, for example: - class TestNetnsManager(unittest.TestCase): - def setUp(self): // preparing the testig - pass - def tearDown(self):// cleanup after testing - pass - def testCase1(self):// cases - pass - -3.single modules testing, appending below code at the end of the module, execute 'python test_env.py'. - -if __name__ == "__main__": - import logging - logging.getLogger(__name__) - logging.basicConfig(level = logging.DEBUG) - unittest.main() - -4.multiple modules integration, create run_test.py,run_test.py the example code as below: - -import unittest -import importlib - -test_order_list = [ - "vstf.services.agent.unittest.perf.test_utils", - "vstf.services.agent.unittest.perf.test_netns", - "vstf.services.agent.unittest.perf.test_netperf", - "vstf.services.agent.unittest.perf.test_qperf", - "vstf.services.agent.unittest.perf.test_pktgen", -] - -if __name__ == '__main__': - import logging - logging.getLogger(__name__) - logging.basicConfig(level = logging.DEBUG) - for mod_name in test_order_list: - mod = importlib.import_module(mod_name) - suit = unittest.TestLoader().loadTestsFromModule(mod) - unittest.TextTestRunner().run(suit) -