for process in processes: # 根据流程进行打包 package = ProcessPackage(process.name) # 打包流程 package.pack(process) self.packages.add_package(package) if self.serialize: self.save_to_file() else: raise ValueError("Reader is None!") def save_to_file(self): self.packages.gen_id() p = os.path.join(config.case["serialize_path"], "serialized") if not os.path.exists(p): os.mkdir("serialized") path = os.path.join(p, "{}.pkl".format(self.packages.id)) with open(path, "wb") as f: pickle.dump(self.packages, f) if __name__ == '__main__': r = ExcelReader() p = ProcessPackager() p.select_reader(r) p.packing() p.use_dumps = True # print(isinstance(p.send(),bytes)) data = pickle.loads(p.send()) print(data)
def run_by_name(self, name): """ 运行传入的文件名 :param name: :return: """ self.manager.execute_one_by_name(name) def run_one(self): """ 执行一个文件 :return: """ self.manager.execute_one_process() if __name__ == '__main__': r = ExcelReader("/home/amdins/桌面/teach/seleniums/selenium/case.xlsx") man = CaseManager() man.register_reader(r) man.register_packager(ProcessPackager()) man.register_porter(Porter()) man.start() exec = ExecuteCenter() exec.recv_porter(man.get_porter()) exec.distribute() exec.register_execute(NormalExecutor()) exec.add_plugin(AssertPlugin("")) exec.run_one()
from case.reader.excel import ExcelReader from execute.driverexecute import NormalExecutor from managers.manager import Manager """ """ if __name__ == '__main__': r = ExcelReader("/home/amdins/桌面/SeleniumAutoTest/case.xlsx") man = Manager() man.select_reader(r) man.register_executor(NormalExecutor()) man.get_execute().run_by_name("case")