()
return jsonify({'msg': '测试完成', 'status': 1, 'data': {'report_id': d.new_report_id, 'data': res}})
跑接口
跑接口
跑接口
def run_cases():
    """ 跑接口 """
    data = request.json
    case_ids = data.get('sceneIds')
    project_id = data.get('projectId')
    if not project_id:
        return jsonify({'msg': '请选择项目', 'status': 0})
    if not case_ids:
        return jsonify({'msg': '请选择用例', 'status': 0})

    d = RunCase(project_id)
    d.get_case_test(case_ids)
    jump_res = d.run_case()

    if data.get('reportStatus'):
        performer = User.query.filter_by(id=current_user.id).first().name
        d.build_report(jump_res, case_ids, performer)
    res = json.loads(jump_res)

    return jsonify({'msg': '测试完成', 'status': 1, 'data': {'report_id': d.new_report_id, 'data': res}})
def run_cases ( ) : data = request . json case_ids = data . get ( 'sceneIds' ) project_id = data . get ( 'projectId' ) if not project_id : return jsonify ( { 'msg' : '请选择项目', 'status' : 0}) if not case_ids : return jsonify ( { 'msg' : '请选择用例', 'status' : 0}) d = RunCase ( project_id ) d . get_case_test ( case_ids ) jump_res = d . run_case ( ) if data . get ( 'reportStatus' ) : performer = User . query . filter_by ( id = current_user . id ) . first ( ) . name d . build_report ( jump_res , case_ids , performer ) res = json . loads ( jump_res ) return jsonify ( { 'msg' : '测试完成', 'statu s : 1, 'da t ' : {'repo r _ id': d.new_ r p o rt_id, 'data' : res}})