/// <summary> /// 启动执行 /// </summary> public void runScene() { while (true) { var Scene = testHelper.rc.GetRunScene(this.device); if (Scene == null) { break; } if (!string.IsNullOrEmpty(Scene.installApk) && string.IsNullOrEmpty(Scene.installResult))//安装任务未完成,先进行安装 { string filePath = System.Environment.CurrentDirectory + "\\apkInstall\\" + this.device + "\\"; if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } if (testHelper.rc.downApk(Scene.installApk, filePath)) { //***************此处上传安装结果******************// SceneInstallResult_req req = new SceneInstallResult_req(); req.installResult = this.install(filePath); req.ID = Scene.id; if (!testHelper.rc.SceneInstallResult(req)) { logHelper.error("上传安装结果失败 场景ID:" + Scene.id); } } else { logHelper.error("下载apk失败 场景ID:" + Scene.id); } } foreach (var rcm in Scene.caseList) { if (rcm.state != null && rcm.state > 0) { continue; } logHelper.info(this.listBoxText + "开始执行执行案例 id:" + rcm.id); if (!runCase(rcm.id)) { logHelper.error("批量执行案例失败 id:" + rcm.id); break;//报错退出这个场景 } } } }
public IHttpActionResult SceneInstallResult([FromBody] SceneInstallResult_req req) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } QCTESTEntities QC_DB = new QCTESTEntities(); //属于这台手机并已经开始的场景 var rtc = QC_DB.M_runScene.First(t => t.ID == req.ID); rtc.installResult = req.installResult; QC_DB.SaveChanges(); return(Ok()); }