public DebugInfoProvider(string binaryPath, ICrossDomainLogger logger) { this.binaryPath = binaryPath; this.logger = logger; try { session = new DiaSession(binaryPath); } catch (Exception ex) { string message = String.Format("Cannot setup debug info for binary '{0}'", binaryPath); logger.Debug(new ExceptionLogInfo(ex), message); session = noSession; } try { asyncMethodHelper = new AsyncMethodHelper(binaryPath); } catch (Exception ex) { string message = String.Format("Cannot setup async debug info for binary '{0}'", binaryPath); logger.Debug(new ExceptionLogInfo(ex), message); asyncMethodHelper = noAsyncHelper; } }
int Execute(string binaryPath, string[] exampleFullNames, IProgressRecorder progressRecorder, ICrossDomainLogger logger) { string scenario = (exampleFullNames == RunnableContextFinder.RunAll ? "all" : "selected"); logger.Debug(String.Format("Start executing {0} tests locally in binary '{1}'", scenario, binaryPath)); int count; try { var runnableContextFinder = new RunnableContextFinder(); var runnableContexts = runnableContextFinder.Find(binaryPath, exampleFullNames); var executedExampleMapper = new ExecutedExampleMapper(); var executionReporter = new ExecutionReporter(progressRecorder, executedExampleMapper); var contextExecutor = new ContextExecutor(executionReporter, logger); count = contextExecutor.Execute(runnableContexts); } catch (Exception ex) { // report problem and return, without letting exception cross app domain boundary count = 0; var exInfo = new ExceptionLogInfo(ex); var message = String.Format("Exception thrown while executing tests locally in binary '{0}'", binaryPath); logger.Error(exInfo, message); } logger.Debug(String.Format("Finish executing {0} tests locally in binary '{1}'", count, binaryPath)); return(count); }
public DiscoveredExample[] Discover(string binaryPath, ICrossDomainLogger logger) { logger.Debug(String.Format("Start discovering tests locally in binary '{0}'", binaryPath)); DiscoveredExample[] discoveredExampleArray; try { var exampleFinder = new ExampleFinder(); var examples = exampleFinder.Find(binaryPath); var debugInfoProvider = new DebugInfoProvider(binaryPath, logger); var discoveredExampleMapper = new DiscoveredExampleMapper(binaryPath, debugInfoProvider); var discoveredExamples = examples.Select(discoveredExampleMapper.FromExample); discoveredExampleArray = discoveredExamples.ToArray(); } catch (Exception ex) { // report problem and return, without letting exception cross app domain boundary discoveredExampleArray = new DiscoveredExample[0]; var exInfo = new ExceptionLogInfo(ex); var message = String.Format("Exception thrown while discovering tests locally in binary '{0}'", binaryPath); logger.Error(exInfo, message); } logger.Debug(String.Format("Finish discovering {0} tests locally in binary '{1}'", discoveredExampleArray.Length, binaryPath)); return(discoveredExampleArray); }