Example #1
0
        //其实这个方法也可以放到 RunFactor里,为了直观所以放在这里
        static void startRun(oneBlockCase _case)
        {
            Console.ForegroundColor = ConsoleColor.White;
            RunFactory      runFactory = new RunFactory();
            List <BaseStep> runSteps   = new List <BaseStep>();

            foreach (var st in _case.steps)
            {
                var tmp = runFactory.greateStep(st);
                if (tmp != null)
                {
                    runSteps.Add(tmp);
                }
            }

            foreach (var step in runSteps)
            {
                try {
                    Console.Write($"{step}:{step.__describe} 开始执行...");
                    step.Excite();
                    Console.WriteLine("完成!");
                } catch (Exception e) {
                    step.executRecord.screenshot    = runFactory.snapshot();
                    step.executRecord.recordType    = 500;
                    step.executRecord.recordMessage = e.StackTrace;
                    break;//结束执行
                }
            }

            Console.WriteLine();

            Console.WriteLine("执行结果:");
            runFactory.killThemAll();
            result(runSteps);


            Console.ForegroundColor = ConsoleColor.White;
        }