Exemple #1
0
    def post(self):
        args = self.parser.parse_args()
        category = args["category"].lower()
        if args["method"] == "run":
            project = self.app.config["AUTO_HOME"] + "/workspace/%s/%s" % (
                session['username'], args["project"])
            output = self.app.config["AUTO_HOME"] + "/jobs/%s/%s" % (
                session['username'], args["project"])
            if category == "project":
                if not is_run(self.app, args["project"]):
                    p = multiprocessing.Process(target=robot_run,
                                                args=(project, output))
                    p.start()
                    self.app.config["AUTO_ROBOT"].append({
                        "name":
                        args["project"],
                        "process":
                        p
                    })
                else:
                    return {"status": "fail", "msg": "请等待上一个任务完成"}
            #elif category == "suite":
            #    pass
            #elif category == "case":
            #    pass

            return {"status": "success", "msg": "已启动运行"}
        elif args["method"] == "stop":
            stop_robot(self.app, args["project"])

            return {"status": "success", "msg": "已停止运行"}
        elif args["method"] == "delete":
            delete_task_record(self.app, args["project"], args["task_no"])

            return {"status": "success", "msg": "已经删除记录"}
Exemple #2
0
    def post(self):
        args = self.parser.parse_args()

        if args["method"] == "run" or args["method"] == "editor_run":
            return self.runall(args)
        elif args["method"] == "debug_run":
            return self.debug_run(args)
        elif args["method"] == "runpass":
            return self.runpassfail(args, True)
        elif args["method"] == "runfail":
            return self.runpassfail(args, False)
        elif args["method"] == "runtags":
            return self.runtags(args)
        elif args["method"] == "runfile":
            return self.runfile(args)

        elif args["method"] == "rerun":
            return self.rerun_task(args)
        elif args["method"] == "rerunfail":
            return self.rerunfail_task(args)

        elif args["method"] == "stop":
            return stop_robot(self.app, args)

        elif args["method"] == "delete":
            delete_task_record(self.app, args)
            return {"status": "success", "msg": "删除成功."}
        else:
            return {
                "status": "fail",
                "msg": "Parameter 'method' Error:{}".format(args['method'])
            }