测试套件文件下的testcase
import importlib import sys, time, unittest from gevent import os import os from common import file_util, BSTestRunner from testcases.dispatcher import inbound_case,inBoundRevert_case,outbound_case,outboundRevert_case,bizLock_case,revertBizLock_case importlib.reload(sys) ''' xx服务接口 批量运行 ''' if __name__=="__main__": delDir = '' report_path = '' if os.name == 'posix': delDir = os.path.abspath('..') + "/report" # 将测试用例加入到测试容器中 report_path = os.path.abspath('..') + "/report/" elif os.name == 'nt': delDir = os.path.abspath('..') + "\report" # 将测试用例加入到测试容器中 report_path = os.path.abspath('..') + "\report\" file_util.del_files(delDir) testunit = unittest.TestSuite() '''执行入库单接口测试集''' testunit.addTest(inbound_case.InBound("test_inBoundWithBatch")) testunit.addTest(inbound_case.InBound("test_inBoundN0Batch")) testunit.addTest(inbound_case.InBound("test_inBoundWithBatchTwo")) testunit.addTest(inbound_case.InBound("test_inBoundOrder")) testunit.addTest(inbound_case.InBound("test_inBoundProd")) ''' 执行撤销入库接口测试集 ''' testunit.addTest(inBoundRevert_case.inBoundRevert("test_inBoundRevertBatch")) testunit.addTest(inBoundRevert_case.inBoundRevert("test_inBoundRevert")) testunit.addTest(inBoundRevert_case.inBoundRevert("test_inBoundRevert_Two")) testunit.addTest(inBoundRevert_case.inBoundRevert("test_inBoundRevertOrder")) ''' 执行锁定接口测试集 bizLock_case ''' testunit.addTest(bizLock_case.BizLock("test_Salesorder_OneItem")) testunit.addTest(bizLock_case.BizLock("test_SalersOrder_twoItem")) testunit.addTest(bizLock_case.BizLock("test_salersOrder_Other")) testunit.addTest(bizLock_case.BizLock("test_salersOrder_repeat")) testunit.addTest(bizLock_case.BizLock("test_Salesorder_different")) ''' 执行撤销锁定接口测试集 revertBizLock_case ''' testunit.addTest(revertBizLock_case.RevertBizlock("test_revert_NoOrder")) testunit.addTest(revertBizLock_case.RevertBizlock("test_revert_lockNo")) testunit.addTest(revertBizLock_case.RevertBizlock("test_revert_Two")) # testunit.addTest(revertBizLock_case.RevertBizlock("test_Mandatory")) ''' 执行出库接口测试集 ''' testunit.addTest(outbound_case.out_bound("test_outBoundBatchTwo")) testunit.addTest(outbound_case.out_bound("test_outBoundOrder")) testunit.addTest(outbound_case.out_bound("test_outBoundOrder3")) testunit.addTest(outbound_case.out_bound("test_outBoundBatchOne")) testunit.addTest(outbound_case.out_bound("test_outBound_enough")) testunit.addTest(outbound_case.out_bound("test_outBound_NotEnough")) testunit.addTest(outbound_case.out_bound("test_outBoundProdDate")) testunit.addTest(outbound_case.out_bound("test_outBound_other")) testunit.addTest(outbound_case.out_bound("outBoundBatch_RefTwo")) testunit.addTest(outbound_case.out_bound("test_outBoundMove")) ''' 执行撤销出库接口测试集 ''' testunit.addTest(outboundRevert_case.outBoundRevert("test_out_revert")) testunit.addTest(outboundRevert_case.outBoundRevert("test_out_revertEnough")) testunit.addTest(outboundRevert_case.outBoundRevert("test_out_revertTwo")) testunit.addTest(outboundRevert_case.outBoundRevert("test__out_revertRef")) now = time.strftime("%Y%m%M%H%M%S", time.localtime(time.time())) fp = open(report_path + now + "-result.html", 'wb') runner = BSTestRunner.BSTestRunner(stream=fp, title='xx服务接口测试', description=u'result:') runner.run(testunit) fp.close()