void OnStartTest(XElement xml) { var test = ParseTest(xml); TestStarted?.Invoke(this, new TestEventArgs(test.FullyQualifiedName, null)); if (Options.DesignTime) { _sink?.SendTestStarted(test); } }
public MultiplexedTestRunner(IUnityContainer container, IOptions options) : base(container) { _options = options; UpdateImplementation(); foreach (var implementation in _implementations.Values) { implementation.DebuggingStarted += (o, e) => DebuggingStarted?.Invoke(this, e); implementation.TestStarted += (o, e) => TestStarted?.Invoke(this, e); implementation.TestExecuted += (o, e) => TestExecuted?.Invoke(this, e); implementation.TestLogAdded += (o, e) => TestLogAdded?.Invoke(this, e); implementation.TestsAborted += (o, e) => TestsAborted?.Invoke(this, e); implementation.TestsFailed += (o, e) => TestsFailed?.Invoke(this, e); implementation.TestsFinished += (o, e) => TestsFinished?.Invoke(this, e); implementation.TestsStarted += (o, e) => TestsStarted?.Invoke(this, e); } options.PropertyChanged += OnOptionChanged; }
public void RunTests() { var project = GetProject(FilePath); var targetPath = project.GetPropertyValue("TargetPath"); var eventListener = new TestRunnerListener( (i) => TestRunFinishedWithException.Raise(this, i), (i) => TestRunFinishedWithResult.Raise(this, i), (i, j) => TestRunStarted.Raise(this, i, j), (i) => TestSuiteFinished.Raise(this, i), (i) => TestSuiteStarted.Raise(this, i), (i) => TestFinished.Raise(this, i), (i) => TestOutput.Raise(this, i), (i) => TestStarted.Raise(this, i), (i) => TestUnhandledException.Raise(this, i)); var testRunner = new TestRunner(targetPath, eventListener); testRunner.Run(); }
public void Handle(TestStarted message) { CurrentIteration = 0; _output.Clear(); NumberOfIterations = _config.NumberOfRuns; }
private void OnTestStarted(TestMethod test) { TestStarted?.Invoke(this, new TestStartedEventArgs(test)); // This call is safe - OnTestStarted cannot be called from outside RD's context. _uiDispatcher.FlushMessageQueue(); }
private void HandleTestStarted(TestStarted x) { // in real life: write to DB TestRuns.Add(new TestResultDto(x.Url, x.TestName)); }
protected void OnTestStarted(TestMethod testMethod) { _dispatcher.BeginInvoke(() => TestStarted?.Invoke(this, new EventArgs <TestMethod>(testMethod))); }
void When(TestStarted e) => Then(new TestStartedObserved { Cause = Context.Call.Point.Cause, Position = Context.Call.Point.Position });
protected virtual void OnTestStarted(UnitTestTestEventArgs e) => TestStarted?.Invoke(this, e);
public async Task Start(Uri targetUri) { if (!(await IsRemoteServerAlive(targetUri))) { throw new WebException("No response from external server"); } resultDetails = new ConcurrentBag <TestResultDetail>(); processedPages = new ConcurrentDictionary <string, byte>(); result = new TestResult() { Authority = targetUri.AbsoluteUri, TestDate = DateTime.Now, Status = 1 }; RepositoryInsertRequested?.Invoke(this, new TestResultArgs(result)); CrawlConfiguration configuration = new CrawlConfiguration() { MaxPagesToCrawl = MaxPagesToCrawl, MaxCrawlDepth = MaxCrawlDepth, IsExternalPageCrawlingEnabled = IsExternalPageCrawlingEnabled, IsExternalPageLinksCrawlingEnabled = IsExternalPageLinksCrawlingEnabled, NumberOfRecurrentRequests = NumberOfRecurrentRequests, MaxConcurrentThreads = MaxConcurrentThreads }; PoliteWebCrawler crawler = new PoliteWebCrawler(configuration, crawlDecisionMaker: null, memoryManager: null, scheduler: null, hyperLinkParser: null, domainRateLimiter: null, robotsDotTextFinder: null, threadManager: null, pageRequester: new PageRequesterWithRepeats(configuration)); crawler.PageRequestSent += Crawler_PageRequestSent; crawler.PageResponseReceived += Crawler_PageResponseReceived; crawler.PageCrawlCompleted += Crawler_ProcessPageCrawlCompleted; crawler.ShouldCrawlPage((pageToCrawl, crawlContext) => { CrawlDecision decision = new CrawlDecision { Allow = true }; MatchCollection mc = Regex.Matches((pageToCrawl.Uri.AbsoluteUri), @"http[s]?:\/\/"); if (mc.Count > 1) { return new CrawlDecision { Allow = false, Reason = "Dont want to crawl external pages" } } ; return(decision); }); TestStarted?.Invoke(this, new TestResultArgs(result)); crawler.Crawl(targetUri); result.TestResultDetails = resultDetails.ToList(); result.MinResponseTime = rootMinResponseTime; result.MaxResponseTime = rootMaxResponseTime; result.MeanResponseTime = rootMeanResponseTime / numberOfPagesCrawled; result.Status = 0; TestFinished?.Invoke(this, new TestResultArgs(result)); RepositoryInsertDetailsRequested?.Invoke(this, new TestResultArgs(result)); }
public void Start(TestResult root) { using (HttpClient client = new HttpClient()) { var testBlock = new ActionBlock <TestResultDetail>(async item => { Stopwatch timer = new Stopwatch(); double mean = 0; for (int i = 1; i <= NumberOfRecurrentRequests; ++i) { timer.Start(); await client.GetAsync(item.Uri); timer.Stop(); long responseTime = timer.ElapsedMilliseconds; timer.Reset(); if (i == 1) { ProcessFirstItem(item, responseTime); } else { ProcessItem(item, responseTime); } mean += responseTime / NumberOfRecurrentRequests; } item.MeanResponseTime = mean; PageTestingCompleted?.Invoke(this, new PageTestingCompletedArgs(item)); lock (mainLock) { rootMeanResponseTime += item.MeanResponseTime; if (item.MinResponseTime < rootMinResponseTime) { rootMinResponseTime = item.MinResponseTime; } if (item.MaxResponseTime > rootMaxResponseTime) { rootMaxResponseTime = item.MaxResponseTime; } } }, new ExecutionDataflowBlockOptions() { MaxDegreeOfParallelism = MaxConcurrentThreads }); foreach (var item in root.TestResultDetails) { testBlock.Post(item); } testBlock.Complete(); root.TestDate = DateTime.Now; root.Status = 1; RepositoryUpdateRequested?.Invoke(this, new TestResultArgs(root)); TestStarted?.Invoke(this, new TestResultArgs(root)); testBlock.Completion.Wait(); } root.MinResponseTime = rootMinResponseTime; root.MaxResponseTime = rootMaxResponseTime; root.MeanResponseTime = rootMeanResponseTime / root.TestResultDetails.Count; root.Status = 0; TestFinished?.Invoke(this, new TestResultArgs(root)); RepositoryUpdateRequested?.Invoke(this, new TestResultArgs(root)); }
void ITestExecutionMonitor.RecordStart(TestCase testCase) { TestStarted?.Invoke(this, new EventArgs <TestCase>(testCase)); }
public void Handle(TestStarted message) { IsRunning = true; ActivateItem(Items.First(t => t.TabTitle != "Configuration")); }