当前位置: 首页>>代码示例>>C#>>正文


C# IFrameworkHandle.RecordResult方法代码示例

本文整理汇总了C#中IFrameworkHandle.RecordResult方法的典型用法代码示例。如果您正苦于以下问题:C# IFrameworkHandle.RecordResult方法的具体用法?C# IFrameworkHandle.RecordResult怎么用?C# IFrameworkHandle.RecordResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFrameworkHandle的用法示例。


在下文中一共展示了IFrameworkHandle.RecordResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunTests

        /// <summary>
        /// Runs the tests.
        /// </summary>
        /// <param name="tests">Tests to be run.</param>
        /// <param name="runContext">Context to use when executing the tests.</param>
        /// <param param name="frameworkHandle">Handle to the framework to record results and to do framework operations.</param>
        public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            m_cancelled = false;
            try
            {
                foreach (TestCase test in tests)
                {
                    if (m_cancelled)
                    {
                        break;
                    }
                    frameworkHandle.RecordStart(test);
                    frameworkHandle.SendMessage(TestMessageLevel.Informational, "Starting external test for " + test.DisplayName);
                    var testOutcome = RunExternalTest(test, runContext, frameworkHandle, test);
                    frameworkHandle.RecordResult(testOutcome);
                    frameworkHandle.SendMessage(TestMessageLevel.Informational, "Test result:" + testOutcome.Outcome.ToString());


                }
            }
            catch(Exception e)
            {
                frameworkHandle.SendMessage(TestMessageLevel.Error, "Exception during test execution: " +e.Message);
            }
}
开发者ID:XpiritBV,项目名称:ProtractorAdapter,代码行数:31,代码来源:ProtractorTestExecutor.cs

示例2: RunTests

        /// <summary>
        /// Runs the tests.
        /// </summary>
        /// <param name="testBinaries">Where to look for tests to be run.</param>
        /// <param name="context">Context in which to run tests.</param>
        /// <param param name="framework">Where results should be stored.</param>
        public void RunTests(IEnumerable<string> testBinaries, IRunContext context, IFrameworkHandle framework)
        {
            _state = ExecutorState.Running;

            foreach (var testBinary in testBinaries)
            {
                if (_state == ExecutorState.Cancelling)
                {
                    _state = ExecutorState.Cancelled;
                    return;
                }

                var reportDocument = RunOrDebugCatchTest(testBinary, "*", context, framework);

                var tests = CatchTestDiscoverer.ListTestsInBinary(testBinary);
                foreach (var test in tests)
                {
                    try
                    {
                        var result = GetTestResultFromReport(test, reportDocument, framework);
                        framework.RecordResult(result);
                    }
                    catch (Exception ex)
                    {
                        // Log it and move on. It will show up to the user as a test that hasn't been run.
                        framework.SendMessage(TestMessageLevel.Error, "Exception occured when processing test source: " + test.FullyQualifiedName);
                        framework.SendMessage(TestMessageLevel.Informational, "Message: " + ex.Message + "\nStacktrace:" + ex.StackTrace);
                    }
                }
            }
        }
开发者ID:mrpi,项目名称:CatchVsTestAdapter,代码行数:37,代码来源:CatchTestExecutor.cs

示例3: RunTests

 public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
 {
     foreach(var source in tests.GroupBy(x => x.Source, x => x.FullyQualifiedName)) {
         var xDomainSink = new TestAdapterLogger(frameworkHandle, source.Key);
         xDomainSink.OnSuccess += (_, e) => frameworkHandle.RecordResult(new TestResult(e.TestCase) { Outcome = TestOutcome.Passed, Duration = e.Duration, });
         xDomainSink.OnPending += (_, e) => frameworkHandle.RecordResult(new TestResult(e.TestCase) { Outcome = TestOutcome.Skipped, Duration = e.Duration });
         xDomainSink.OnFailure += (_, e) => frameworkHandle.RecordResult(new TestResult(e.TestCase) {
             Outcome = TestOutcome.Failed,
             Duration = e.Duration,
             ErrorMessage = e.ErrorMessage,
             ErrorStackTrace = e.ErrorStackTrace,
         });
         CrossDomainConeRunner.WithProxyInDomain<ConeTestAdapterProxy, int>(string.Empty,
             new [] { source.Key, },
             proxy => proxy.RunTests(source.Key, xDomainSink, source.ToArray())
         );
     }
 }
开发者ID:drunkcod,项目名称:Cone,代码行数:18,代码来源:ConeTestExecutor.cs

示例4: RunTests

 private void RunTests(string source, IRunContext runContext, IFrameworkHandle frameworkHandle)
 {
     foreach (var result in ExternalTestExecutor.GetTestResults(source, null).Select(c => CreateTestResult(source, c)))
     {
         frameworkHandle.RecordStart(result.TestCase);
         frameworkHandle.RecordResult(result);
         frameworkHandle.RecordEnd(result.TestCase, result.Outcome);
     }
 }
开发者ID:fazueu,项目名称:TestAdapters,代码行数:9,代码来源:TestExecutor.cs

示例5: RunTests

        public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext,
               IFrameworkHandle frameworkHandle)
        {
            mCancelled = false;

            foreach (TestCase test in tests)
            {
                if (mCancelled) break;

                var testResult = new TestResult(test);

                testResult.Outcome = (TestOutcome)test.GetPropertyValue(TestResultProperties.Outcome);
                frameworkHandle.RecordResult(testResult);
            }
        }
开发者ID:Tokiota,项目名称:PildorasALM,代码行数:15,代码来源:JsonTestExecutor.cs

示例6: RunTests

        /// <summary>
        /// Entry point for run single
        /// </summary>
        /// <param name="tests"></param>
        /// <param name="runContext"></param>
        /// <param name="frameworkHandle"></param>
        public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            //System.Diagnostics.Debugger.Launch();
              var groups = tests.GroupBy(x => x.Source, x => x, (x, y) => new
              {
            Source = x,
            TestCases = y
              }).ToList();

              var results = new List<DefinitionSource>();
              foreach (var groupedItem in groups)
              {
            using (var sandbox = new Sandbox<Executor>(groupedItem.Source))
            {
              var targetTypes = groupedItem.TestCases
                          .Select(x => new DefinitionSource() { ClassName = new Uri(GetSpecID(x)).Host }).ToArray();
              var result = sandbox.Content.Execute(targetTypes);
              results.AddRange(result);
            }
              }

              var joinedList = from r in results
                       join tc in groups.SelectMany(x => x.TestCases) on r.Id equals GetSpecID(tc)
                       select new { TestResult = r, TestCase = tc };

              foreach (var resultItem in joinedList)
              {

            var testResult = new TestResult(resultItem.TestCase);
            if (resultItem.TestResult.Enabled)
            {
              testResult.DisplayName = resultItem.TestResult.Description;
              testResult.Outcome = resultItem.TestResult.RanSuccesfully ? TestOutcome.Passed : TestOutcome.Failed;
              testResult.Duration = resultItem.TestResult.EndTime - resultItem.TestResult.StartTime;
              testResult.ErrorStackTrace = resultItem.TestResult.StackTrace;
            }
            else
            {
              testResult.Outcome = TestOutcome.Skipped;
            }

            testResult.ErrorMessage = resultItem.TestResult.ExecutionResult; ;
            frameworkHandle.RecordResult(testResult);
              }
        }
开发者ID:leohinojosa,项目名称:spec,代码行数:51,代码来源:specTestExecutor.cs

示例7: RunTests

        public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            IEnumerable<KarmaTestResult> results = GetTestResults(runContext);

            foreach (var test in tests)
            {
                var result = results.FirstOrDefault(x => x.Name.EndsWith(test.DisplayName));

                if(result != null)
                {
                    TestOutcome testOutcome = ResultTestOutcome(result);

                    frameworkHandle.RecordResult(new TestResult(test)
                    {
                        Outcome = testOutcome
                    });
                }
            }
        }
开发者ID:yanivru,项目名称:Dharma,代码行数:19,代码来源:TaskExecutor.cs

示例8: RunTests

        public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            _cancelled = false;

            foreach (TestCase test in tests)
            {
                if (_cancelled)
                    break;

                var testResult = new TestResult(test);

                string fileName = test.Source;
                string testName = test.DisplayName;

                RunFileOrTest(frameworkHandle, runContext, fileName, testName);

                testResult.Outcome = TestOutcome.Passed;

                frameworkHandle.RecordResult(testResult);
            }
        }
开发者ID:scrom,项目名称:NodeUnitTestAdapter,代码行数:21,代码来源:NodeUnitTestExecutor.cs

示例9: RunTests

        public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext,
               IFrameworkHandle frameworkHandle)
        {
            _mCancelled = false;
            SetupExecutionPolicy();
            foreach (var test in tests)
            {
                if (_mCancelled) break;

                var testFramework = test.FullyQualifiedName.Split(new[] { "||" }, StringSplitOptions.None)[0];

                var executor = _testExecutors.FirstOrDefault(
                    m => m.TestFramework.Equals(testFramework, StringComparison.OrdinalIgnoreCase));

                if (executor == null)
                {
                    frameworkHandle.SendMessage(TestMessageLevel.Error, String.Format("Unknown test executor: {0}", testFramework));
                    return;
                }

                var testResult = new TestResult(test);
                testResult.Outcome = TestOutcome.Failed;
                testResult.ErrorMessage = "Unexpected error! Failed to run tests!";

                PowerShellTestResult testResultData = null;
                var testOutput = new StringBuilder();

                try
                {
                    var testAdapter = new TestAdapterHost();
                    testAdapter.HostUi.OutputString = s => testOutput.Append(s);

                    var runpsace = RunspaceFactory.CreateRunspace(testAdapter);
                    runpsace.Open();

                    using (var ps = PowerShell.Create())
                    {
                        ps.Runspace = runpsace;

                        testResultData = executor.RunTest(ps, test, runContext);
                    }
                }
                catch (Exception ex)
                {
                    testResult.Outcome = TestOutcome.Failed;
                    testResult.ErrorMessage = ex.Message;
                    testResult.ErrorStackTrace = ex.StackTrace;
                }

                if (testResultData != null)
                {
                    testResult.Outcome = testResultData.Outcome;
                    testResult.ErrorMessage = testResultData.ErrorMessage;
                    testResult.ErrorStackTrace = testResultData.ErrorStacktrace;
                }

                if (testOutput.Length > 0)
                {
                    frameworkHandle.SendMessage(TestMessageLevel.Informational, testOutput.ToString());    
                }
                
                frameworkHandle.RecordResult(testResult);
            }

        }
开发者ID:vairam-svs,项目名称:poshtools,代码行数:65,代码来源:PowerShellTestExecutor.cs

示例10: RunBoostTests

        /// <summary>
        /// Run tests one test at a time and update results back to framework.
        /// </summary>
        /// <param name="testBatches">List of test batches to run</param>
        /// <param name="runContext">Solution properties</param>
        /// <param name="frameworkHandle">Unit test framework handle</param>
        private void RunBoostTests(IEnumerable<TestRun> testBatches, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            BoostTestAdapterSettings settings = BoostTestAdapterSettingsProvider.GetSettings(runContext);

            foreach (TestRun batch in testBatches)
            {
                if (_cancelled)
                {
                    break;
                }

                DateTimeOffset start = new DateTimeOffset(DateTime.Now);

                try
                {
                    Logger.Info("{0}:   -> [{1}]", ((runContext.IsBeingDebugged) ? "Debugging" : "Executing"), string.Join(", ", batch.Tests));

                    CleanOutput(batch.Arguments);

                    // Execute the tests
                    if (ExecuteTests(batch, runContext, frameworkHandle))
                    {
                        foreach (VSTestResult result in GenerateTestResults(batch, start, settings))
                        {
                            // Identify test result to Visual Studio Test framework
                            frameworkHandle.RecordResult(result);
                        }
                    }
                }
                catch (Boost.Runner.TimeoutException ex)
                {
                    foreach (VSTestCase testCase in batch.Tests)
                    {
                        VSTestResult testResult = GenerateTimeoutResult(testCase, ex);
                        testResult.StartTime = start;

                        frameworkHandle.RecordResult(testResult);
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error("Exception caught while running test batch {0} [{1}] ({2})", batch.Source, string.Join(", ", batch.Tests), ex.Message);
                }
            }
        }
开发者ID:timopk,项目名称:vs-boost-unit-test-adapter,代码行数:51,代码来源:BoostTestExecutor.cs

示例11: RunFileOrTest

        private static void RunFileOrTest(IFrameworkHandle frameworkHandle, IRunContext runContext, string fileName, string testName = null)
        {
            frameworkHandle.SendMessage(TestMessageLevel.Informational, "runContext.SolutionDirectory: " + runContext.SolutionDirectory);
            frameworkHandle.SendMessage(TestMessageLevel.Informational, "runContext.TestRunDirectory: " + runContext.TestRunDirectory);
            frameworkHandle.SendMessage(TestMessageLevel.Informational, "source: " + fileName);

            string nodeFullPath = NodeJsHelper.LocateNodeJs();

            Process proc = new Process();

            proc.StartInfo.FileName = nodeFullPath;
            proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(fileName);
            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.RedirectStandardInput = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.RedirectStandardError = true;
            proc.StartInfo.CreateNoWindow = true;

            proc.OutputDataReceived += (sender, args) =>
            {
                var data = args.Data;

                if (!string.IsNullOrEmpty(data))
                {
                    frameworkHandle.SendMessage(TestMessageLevel.Informational, "> " + data);

                    if (data.Contains("Error: Cannot find module 'nodeunit'"))
                    {
                        if (!string.IsNullOrEmpty(testName))
                        {
                            GenericFailTest(frameworkHandle, fileName, testName, data);
                        }
                    }
                    else
                    {
                        try
                        {
                            var result = JsonConvert.DeserializeObject<NodeUnitTestResult>(data);

                            if (result != null && !string.IsNullOrEmpty(result.TestName))
                            {
                                var testCase = new TestCase(result.TestName, NodeUnitTestExecutor.ExecutorUri, fileName) { DisplayName = result.TestName };
                                var testResult = new TestResult(testCase) { DisplayName = result.TestName };
                                testResult.Duration = TimeSpan.FromSeconds(Math.Max(.001, result.Duration));
                                testResult.Outcome = result.Passed ? TestOutcome.Passed : TestOutcome.Failed;

                                if (result.Assertions.Length > 0)
                                {
                                    var first = result.Assertions.First();
                                    testResult.ErrorStackTrace = FormatStackTrace(first.Stack);
                                    testResult.ErrorMessage = first.Message;
                                }

                                frameworkHandle.SendMessage(TestMessageLevel.Informational, "Recording Result for " + testCase.DisplayName + " (" + testResult.Outcome.ToString() + ")");
                                frameworkHandle.RecordResult(testResult);
                            }
                        }
                        catch (Newtonsoft.Json.JsonException)
                        {
                            //frameworkHandle.SendMessage(TestMessageLevel.Informational, data);
                        }
                    }
                }
            };

            proc.ErrorDataReceived += (sender, args) =>
            {
                if (!string.IsNullOrEmpty(args.Data))
                {
                    frameworkHandle.SendMessage(TestMessageLevel.Warning, "^ " + args.Data);

                    if (args.Data.Contains("Error: Cannot find module 'nodeunit'"))
                    {
                        if (!string.IsNullOrEmpty(testName))
                        {
                            GenericFailTest(frameworkHandle, fileName, testName, args.Data);
                        }
                    }
                }
            };

            frameworkHandle.SendMessage(TestMessageLevel.Informational, "Process FileName: " + proc.StartInfo.FileName);
            frameworkHandle.SendMessage(TestMessageLevel.Informational, "Process Arguments: " + proc.StartInfo.Arguments);
            frameworkHandle.SendMessage(TestMessageLevel.Informational, "Process WorkingDirectory: " + proc.StartInfo.WorkingDirectory);

            proc.Start();
            proc.BeginOutputReadLine();
            proc.BeginErrorReadLine();

            proc.StandardInput.Write(Resources.RunTests);

            string testFile = Path.GetFileName(fileName).Replace("\\", "\\\\");
            string jsCommand = "runTests(\"" + testFile + "\"";
            if (!string.IsNullOrEmpty(testName))
                jsCommand += ", \"" + testName + "\"";
            jsCommand += ");";
            frameworkHandle.SendMessage(TestMessageLevel.Informational, "Process Emitting Command: " + jsCommand);
            proc.StandardInput.Write(jsCommand);
            proc.StandardInput.Close();

//.........这里部分代码省略.........
开发者ID:scrom,项目名称:NodeUnitTestAdapter,代码行数:101,代码来源:NodeUnitTestExecutor.cs

示例12: GenericFailTest

        private static void GenericFailTest(IFrameworkHandle frameworkHandle, string fileName, string testName, string message = null)
        {
            var testCase = new TestCase(testName, NodeUnitTestExecutor.ExecutorUri, fileName) { DisplayName = testName };
            var testResult = new TestResult(testCase) { DisplayName = testName };
            testResult.Outcome = TestOutcome.Failed;
            testResult.ErrorMessage = message;

            frameworkHandle.SendMessage(TestMessageLevel.Informational, "Recording Result for " + testCase.DisplayName + " (" + testResult.Outcome.ToString() + ")");
            frameworkHandle.RecordResult(testResult);
        }
开发者ID:scrom,项目名称:NodeUnitTestAdapter,代码行数:10,代码来源:NodeUnitTestExecutor.cs

示例13: RunTest

        private void RunTest(TestSourceSettings settings, ITestLogger logger, IRunContext runContext, IFrameworkHandle frameworkHandle, Spec spec)
        {
            var testCase = CreateTestCase(settings, spec);
            var outcome = TestOutcome.None;

            frameworkHandle.RecordStart(testCase);
            foreach (var result in spec.Results)
            {
                if (result.Skipped && outcome != TestOutcome.Failed)
                {
                    outcome = TestOutcome.Skipped;
                }

                if (result.Success && outcome == TestOutcome.None)
                {
                    outcome = TestOutcome.Passed;
                }

                if (!result.Success && !result.Skipped)
                {
                    outcome = TestOutcome.Failed;
                }

                frameworkHandle.RecordResult(GetResult(testCase, result, frameworkHandle));
            }
            frameworkHandle.RecordEnd(testCase, outcome);
        }
开发者ID:jbijlsma,项目名称:JsTestAdapter,代码行数:27,代码来源:TestRunner.cs

示例14: RunTests

        public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            foreach (var test in tests)
            {
                if (this.canceled)
                {
                    return;
                }

                var result = new TestResult(test);

                var target = System.IO.Path.ChangeExtension(test.Source, ".feature");

                try
                {
                    System.IO.File.Copy(test.Source, target);

                    var appDataPath = Environment.GetEnvironmentVariable("APPDATA");
                    var nodePath = System.IO.Path.Combine(appDataPath, "npm");
                    var cucumberPath = System.IO.Path.Combine(nodePath, "node_modules\\cucumber\\bin\\cucumber.js");
                    System.Diagnostics.ProcessStartInfo procStartInfo = runContext.IsBeingDebugged ?
                        new System.Diagnostics.ProcessStartInfo("node", $"--debug=5858 \"{cucumberPath}\" \"{target}:{test.LineNumber}\" -f json") :
                        new System.Diagnostics.ProcessStartInfo("node", $"\"{cucumberPath}\" \"{target}:{test.LineNumber}\" -f json");

                    // The following commands are needed to redirect the standard output.
                    // This means that it will be redirected to the Process.StandardOutput StreamReader.
                    procStartInfo.RedirectStandardOutput = true;
                    procStartInfo.RedirectStandardError = true;
                    procStartInfo.UseShellExecute = false;
                    procStartInfo.CreateNoWindow = true;
                    System.Diagnostics.Process proc = new System.Diagnostics.Process();
                    proc.StartInfo = procStartInfo;
                    proc.Start();

                    if (runContext.IsBeingDebugged)
                    {
                        DteHelpers.DebugAttachToNode(proc.Id, 5678);
                    }

                    proc.WaitForExit();
                    var error = proc.StandardError.ReadToEnd();
                    var output = proc.StandardOutput.ReadToEnd();

                    var features = JArray.Parse(output);

                    // frameworkHandle.SendMessage(Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging.TestMessageLevel.Informational, output);
                    foreach (var feature in features)
                    {
                        frameworkHandle.SendMessage(Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging.TestMessageLevel.Informational, $"{feature["keyword"]}: {feature["name"]}");

                        foreach (var element in feature["elements"])
                        {
                            frameworkHandle.SendMessage(Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging.TestMessageLevel.Informational, $"{element["keyword"]}: {element["name"]}");
                            frameworkHandle.SendMessage(Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging.TestMessageLevel.Informational, $"{element["description"]}");

                            bool passed = true;
                            var duration = 0L;
                            foreach (var step in element["steps"])
                            {
                                var message = $"{step["keyword"]}{step["name"]}";
                                duration = duration + (long)step["result"]["duration"];
                                frameworkHandle.SendMessage(Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging.TestMessageLevel.Informational, message);
                                if ((string)step["result"]["status"] == "failed")
                                {
                                    result.ErrorMessage = (string)step["result"]["error_message"];
                                    frameworkHandle.SendMessage(Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging.TestMessageLevel.Informational, $"{result.ErrorMessage}");
                                    passed = false;
                                }
                            }

                            result.Duration = TimeSpan.FromTicks(duration);

                            if (passed)
                            {
                                result.Outcome = TestOutcome.Passed;
                            }
                            else
                            {
                                result.Outcome = TestOutcome.Failed;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    result.Outcome = TestOutcome.Failed;
                    result.ErrorMessage = ex.Message + ex.StackTrace;
                }
                finally
                {
                    System.IO.File.Delete(target);
                }

                frameworkHandle.RecordResult(result);
            }
        }
开发者ID:endjin,项目名称:CucumberJS.TestAdapter,代码行数:96,代码来源:CucumberJsTestExecutor.cs

示例15: RunBoostTests

        /// <summary>
        /// Run tests one test at a time and update results back to framework.
        /// </summary>
        /// <param name="testBatches">List of test batches to run</param>
        /// <param name="runContext">Solution properties</param>
        /// <param name="frameworkHandle">Unit test framework handle</param>
        private void RunBoostTests(IEnumerable<TestRun> testBatches, IRunContext runContext, IFrameworkHandle frameworkHandle)
        {
            BoostTestAdapterSettings settings = BoostTestAdapterSettingsProvider.GetSettings(runContext);

            foreach (TestRun batch in testBatches)
            {
                if (_cancelled)
                {
                    break;
                }

                DateTimeOffset start = new DateTimeOffset(DateTime.Now);

                try
                {
                    Logger.Info("{0}:   -> [{1}]", ((runContext.IsBeingDebugged) ? "Debugging" : "Executing"), string.Join(", ", batch.Tests));

                    using (TemporaryFile report = new TemporaryFile(batch.Arguments.ReportFile))
                    using (TemporaryFile log    = new TemporaryFile(batch.Arguments.LogFile))
                    using (TemporaryFile stdout = new TemporaryFile(batch.Arguments.StandardOutFile))
                    using (TemporaryFile stderr = new TemporaryFile(batch.Arguments.StandardErrorFile))
                    {
                        Logger.Debug("Working directory: {0}", batch.Arguments.WorkingDirectory ?? "(null)");
                        Logger.Debug("Report file      : {0}", batch.Arguments.ReportFile);
                        Logger.Debug("Log file         : {0}", batch.Arguments.LogFile);
                        Logger.Debug("StdOut file      : {0}", batch.Arguments.StandardOutFile ?? "(null)");
                        Logger.Debug("StdErr file      : {0}", batch.Arguments.StandardErrorFile ?? "(null)");

                        Logger.Debug("CmdLine arguments: {0}", batch.Arguments.ToString() ?? "(null)");

                        // Execute the tests
                        if (ExecuteTests(batch, runContext, frameworkHandle))
                        {
                            foreach (VSTestResult result in GenerateTestResults(batch, start, settings))
                            {
                                // Identify test result to Visual Studio Test framework
                                frameworkHandle.RecordResult(result);
                            }
                        }
                    }
                }
                catch (Boost.Runner.TimeoutException ex)
                {
                    foreach (VSTestCase testCase in batch.Tests)
                    {
                        VSTestResult testResult = GenerateTimeoutResult(testCase, ex);
                        testResult.StartTime = start;

                        frameworkHandle.RecordResult(testResult);
                    }
                }
                catch (Exception ex)
                {
                    Logger.Exception(ex, "Exception caught while running test batch {0} [{1}] ({2})", batch.Source, string.Join(", ", batch.Tests), ex.Message);
                }
            }
        }
开发者ID:netspiri,项目名称:vs-boost-unit-test-adapter,代码行数:63,代码来源:BoostTestExecutor.cs


注:本文中的IFrameworkHandle.RecordResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。