/// <summary> /// tests信息 /// </summary> /// <param name="testsXElement"></param> public TestsNodes(XElement testsXElement) { //1.转为对象 TestsType testsType = new TestsType { TestCases = new Queue <TestCase>() }; foreach (XElement element in testsXElement.Elements(XName.Get("TestCase", ComArgs.RosStr))) { TestCase testCase = new TestCase { Id = element.Attribute(XName.Get("ID", ComArgs.RosStr))?.Value, //给定Id值 TestSteps = new Queue <TestStep>() }; //直接放弃了annotation //绑定一个testcase的步骤 XElement xElement = element.Element(XName.Get("TestSteps", ComArgs.RosStr)); if (xElement != null) { foreach (XElement onestep in xElement.Elements()) { testCase.TestSteps.Enqueue(new ExtractWebAction(onestep, testCase.Id).ExtractWeb); } } //添加 testsType.TestCases.Enqueue(testCase); } //根据实际情况进行配置 TestsType_Info = testsType; }
/// <summary> /// 构造函数 /// Tests对应事件实例 /// 处理整个Tests节点 /// </summary> /// <param name="testsType">一个tests对象</param> public TestsEvents(TestsType testsType) { try { //标注web起始日志 ComArgs.RoLog.WriteLog(LogStatus.LInfo, $"WEB测试日志将写入WebAction_{ComArgs.UseRosName}.log中,具体详情,请查看WebAction_{ComArgs.UseRosName}.log日志"); //执行所有的TestCase while (testsType.TestCases.Any()) { TestCase sig = testsType.TestCases.Dequeue(); ExecuteLogicQueue executeLogicQueue = new ExecuteLogicQueue(sig); } } catch (Exception e) { ComArgs.RoLog.WriteLog(LogStatus.LExpt, "TestsEvents发生异常", e.ToString()); } }