Exemplo n.º 1
0
def generateTestCases(log, arglists):
    """动态生成测试用例类及其方法"""
    log.info("生成测试用例类及其方法")
    class_list = []
    for args in arglists:
        custom_class = type(args["inter"], (myEwsCase,), {"__doc__": args["cases"][0]["description"]})
        for a in args["cases"]:
            setattr(custom_class, "test_%s" % a["testcasename"], myEwsCase.getTestFunc(log, a))
        class_list.append(custom_class)
    return class_list
Exemplo n.º 2
0
def generateTestCases(arglists):
    '''生成测试用例方法'''
    log.info('生成测试用例方法')
    for args in arglists:
        setattr(myEwsCase,'test_%s'%args['TestCaseName'],myEwsCase.getTestFunc(args))