Esempio n. 1
0
        /// <summary>
        /// 运行测试用例
        /// </summary>
        /// <param name="testEngine"></param>
        /// <param name="testEngineUri"></param>
        /// <param name="commandTimeout"></param>
        /// <returns></returns>
        public TestResult Run(ITestEngine testEngine, Uri testEngineUri, TimeSpan commandTimeout)
        {
            TestResult result = new TestResult(Name);

            if (testEngine != null)
            {
                testEngine.Prepare(testEngineUri, TestSiteStartUri, BrowserType, commandTimeout);
                testEngine.Start();
                foreach (var command in GetCommandList())
                {
                    testEngine.ExecuteCommand(command);
                    var errorInfo = testEngine.GetTestErrorInfo();
                    if (errorInfo != null)
                    {
                        result.AddResultItem(errorInfo.AssertName, errorInfo);
                        break;
                    }
                    else if (command.IsAssertMark())
                    {
                        result.AddResultItem(command.AssertName, null);
                    }
                }
                testEngine.Stop();
            }
            return(result);
        }