예제 #1
0
        private void ExecuteTestRun(TestCollection testCollection, IFrameworkHandle frameworkHandle, Dictionary <Test, TestCase> testMapping)
        {
            try
            {
                _testRun = testCollection.CreateTestRun();

                _testRun.TestCompleted += result =>
                {
                    var vsResult = new VisualStudioTestResult(testMapping[result.Test])
                    {
                        Outcome         = OutcomeFromResult(result.Result),
                        Duration        = result.Duration,
                        ErrorMessage    = result.Output,
                        ErrorStackTrace = GetCombinedStackTrace(result.Exception)
                    };

                    vsResult.Messages.Add(new TestResultMessage(TestResultMessage.StandardOutCategory, result.Output));
                    vsResult.ErrorStackTrace = GetCombinedStackTrace(result.Exception);

                    frameworkHandle.RecordResult(vsResult);
                };

                _testRun.ExecuteAsync().GetAwaiter().GetResult();
            }
            catch (Exception ex)
            {
                File.WriteAllText("C:/Users/seamillo/Desktop/jazsharp.testadapter.log", ex.ToString());
                throw;
            }
        }
예제 #2
0
        private void ExecuteTestRun(TestCollection testCollection, IFrameworkHandle frameworkHandle, Dictionary <Test, TestCase> testMapping)
        {
            _testRun = testCollection.CreateTestRun();

            _testRun.TestCompleted += result =>
            {
                var vsResult = new VisualStudioTestResult(testMapping[result.Test])
                {
                    Outcome         = OutcomeFromResult(result.Result),
                    Duration        = result.Duration,
                    ErrorMessage    = result.Output,
                    ErrorStackTrace = GetCombinedStackTrace(result.Exception)
                };

                vsResult.Messages.Add(new TestResultMessage(TestResultMessage.StandardOutCategory, result.Output));
                vsResult.ErrorStackTrace = GetCombinedStackTrace(result.Exception);

                frameworkHandle.RecordResult(vsResult);
            };

            _testRun.ExecuteAsync().GetAwaiter().GetResult();
        }