diff options
author | Yiting.Li <liyiting@huawei.com> | 2015-12-22 17:11:12 -0800 |
---|---|---|
committer | Yiting.Li <liyiting@huawei.com> | 2015-12-22 17:11:12 -0800 |
commit | 8f1101df131a4d3e03b377738507d88b745831c0 (patch) | |
tree | 73f140474fcec2a77c85a453f6946957ca0742d1 /vstf/vstf/controller/unittest/README | |
parent | 1a24ebbda3f95600c0e7d5ed8661317a8ff7e265 (diff) |
Upload the contribution of vstf as bottleneck network framework.
End to End Performance test
JIRA:BOTTLENECK-29
Change-Id: Ib2c553c8b60d6cda9e7a7b52b737c9139f706ebd
Signed-off-by: Yiting.Li <liyiting@huawei.com>
Diffstat (limited to 'vstf/vstf/controller/unittest/README')
-rwxr-xr-x | vstf/vstf/controller/unittest/README | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/vstf/vstf/controller/unittest/README b/vstf/vstf/controller/unittest/README new file mode 100755 index 00000000..f9414e95 --- /dev/null +++ b/vstf/vstf/controller/unittest/README @@ -0,0 +1,49 @@ +""" +Created on 2015-9-28 + +@author: y00228926 +""" + +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) + |