Exemplo n.º 1
0
        public Task OnTestEndAsync(TestContext context, Exception exception, CancellationToken cancellationToken)
        {
            if (exception != null)
            {
                var path    = Path.Combine(context.FileOutput.TestClassOutputDirectory, context.FileOutput.GetUniqueFileName(context.FileOutput.TestName, ".dmp"));
                var process = Process.GetCurrentProcess();
                DumpCollector.Collect(process, path);
            }

            return(Task.CompletedTask);
        }
Exemplo n.º 2
0
        protected override object CallTestMethod(object testClassInstance)
        {
            try
            {
                return(base.CallTestMethod(testClassInstance));
            }
            catch
            {
                if (_collectDumpOnFailure && testClassInstance is LoggedTestBase loggedTestBase)
                {
                    var path    = Path.Combine(loggedTestBase.ResolvedLogOutputDirectory, loggedTestBase.ResolvedTestMethodName + ".dmp");
                    var process = Process.GetCurrentProcess();

                    DumpCollector.Collect(process, path);
                }

                throw;
            }
        }