Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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();
        }