zoukankan      html  css  js  c++  java
  • 接口测试系列:工作中所用(六:测试套件)

    测试套件文件下的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()
    View Code
  • 相关阅读:
    Android 应用开发实例之情景模式
    Android OpenGL 开发
    优化技术之Android UI优化
    优化技术之Android高效开发
    优化技术之高级优化
    优化技术之初级优化
    分享技术,品味人生
    想要快速上手 Spring Boot?看这些教程就足够了!
    给 Android 开发者的 RxJava 详解
    WPF 样式(定义样式、引用样式、样式作用域、Trigger触发器)
  • 原文地址:https://www.cnblogs.com/by170628/p/10096373.html
Copyright © 2011-2022 走看看