public virtual ExecutionStatusResponse Process(ExecutionEndingRequest request) { var result = ExecuteHooks(request.CurrentExecutionInfo); ClearCacheForConfiguredLevel(); return(result); }
public void Setup() { var mockHookRegistry = new Mock <IHookRegistry>(); var mockAssemblyLoader = new Mock <IAssemblyLoader>(); var mockType = new Mock <Type>().Object; mockAssemblyLoader.Setup(x => x.GetLibType(LibType.MessageCollector)).Returns(mockType); mockAssemblyLoader.Setup(x => x.GetLibType(LibType.ScreenshotCollector)).Returns(mockType); var mockMethod = new MockMethodBuilder(mockAssemblyLoader) .WithName("Foo") .WithFilteredHook(LibType.BeforeSpec) .Build(); var hooks = new HashSet <IHookMethod> { new HookMethod(LibType.BeforeSpec, mockMethod, mockAssemblyLoader.Object) }; mockHookRegistry.Setup(x => x.AfterSuiteHooks).Returns(hooks); var executionEndingRequest = new ExecutionEndingRequest { CurrentExecutionInfo = new ExecutionInfo { CurrentSpec = new SpecInfo(), CurrentScenario = new ScenarioInfo() } }; _request = new Message { MessageId = 20, MessageType = Message.Types.MessageType.ExecutionEnding, ExecutionEndingRequest = executionEndingRequest }; _mockMethodExecutor = new Mock <IExecutionOrchestrator>(); _protoExecutionResult = new ProtoExecutionResult { ExecutionTime = 0, Failed = false }; _mockMethodExecutor.Setup(x => x.ExecuteHooks("AfterSuite", It.IsAny <HooksStrategy>(), It.IsAny <IList <string> >(), It.IsAny <ExecutionContext>())) .Returns(_protoExecutionResult); var mockReflectionWrapper = new Mock <IReflectionWrapper>(); mockReflectionWrapper.Setup(x => x.InvokeMethod(mockType, null, "GetAllPendingMessages", It.IsAny <BindingFlags>())) .Returns(_pendingMessages); mockReflectionWrapper.Setup(x => x.InvokeMethod(mockType, null, "GetAllPendingScreenshots", It.IsAny <BindingFlags>())) .Returns(_pendingScreenshots); _executionEndingProcessor = new ExecutionEndingProcessor(_mockMethodExecutor.Object, mockAssemblyLoader.Object, mockReflectionWrapper.Object); }
public void FinishLaunch(ExecutionEndingRequest request) { lock (_lockObj) { _launchesCount--; if (_launchesCount == 0) { _launch.Finish(new FinishLaunchRequest { EndTime = DateTime.UtcNow }); } } }
public void Setup() { var mockHookRegistry = new Mock <IHookRegistry>(); var mockSandbox = new Mock <ISandbox>(); var mockAssemblyLoader = new Mock <IAssemblyLoader>(); mockAssemblyLoader.Setup(x => x.GetLibType(LibType.MessageCollector)); var mockMethod = new MockMethodBuilder(mockAssemblyLoader) .WithName("Foo") .WithFilteredHook(LibType.BeforeSpec) .Build(); var hooks = new HashSet <IHookMethod> { new HookMethod(LibType.BeforeSpec, mockMethod, mockAssemblyLoader.Object) }; mockHookRegistry.Setup(x => x.AfterSuiteHooks).Returns(hooks); var executionEndingRequest = new ExecutionEndingRequest { CurrentExecutionInfo = new ExecutionInfo { CurrentSpec = new SpecInfo(), CurrentScenario = new ScenarioInfo() } }; _request = new Message { MessageId = 20, MessageType = Message.Types.MessageType.ExecutionEnding, ExecutionEndingRequest = executionEndingRequest }; _mockMethodExecutor = new Mock <IMethodExecutor>(); _protoExecutionResult = new ProtoExecutionResult { ExecutionTime = 0, Failed = false }; _protoExecutionResult.Message.AddRange(_pendingMessages); _mockMethodExecutor.Setup(x => x.ExecuteHooks("AfterSuite", It.IsAny <HooksStrategy>(), It.IsAny <IList <string> >(), It.IsAny <Gauge.CSharp.Lib.ExecutionContext>())) .Returns(_protoExecutionResult); var mockReflectionWrapper = new Mock <IReflectionWrapper>(); _executionEndingProcessor = new ExecutionEndingProcessor(_mockMethodExecutor.Object, mockAssemblyLoader.Object, mockReflectionWrapper.Object); }
public override Task <Empty> NotifyExecutionEnding(ExecutionEndingRequest request, ServerCallContext context) { try { TraceLogger.Info($"{nameof(NotifyExecutionEnding)} received"); TraceLogger.Verbose(System.Text.Json.JsonSerializer.Serialize(request)); if (request.SuiteResult != null) { _sender.FinishLaunch(request); } } catch (Exception exp) { TraceLogger.Error(exp.ToString()); } return(Task.FromResult(new Empty())); }
public void Setup() { var mockHookRegistry = new Mock <IHookRegistry>(); var mockAssemblyLoader = new Mock <IAssemblyLoader>(); var mockMethod = new MockMethodBuilder(mockAssemblyLoader) .WithName("Foo") .WithFilteredHook(LibType.BeforeSpec) .Build(); var hooks = new HashSet <IHookMethod> { new HookMethod(LibType.BeforeSpec, mockMethod, mockAssemblyLoader.Object) }; mockHookRegistry.Setup(x => x.AfterSuiteHooks).Returns(hooks); var executionEndingRequest = new ExecutionEndingRequest { CurrentExecutionInfo = new ExecutionInfo { CurrentSpec = new SpecInfo(), CurrentScenario = new ScenarioInfo() } }; _request = executionEndingRequest; _mockMethodExecutor = new Mock <IExecutionOrchestrator>(); _protoExecutionResult = new ProtoExecutionResult { ExecutionTime = 0, Failed = false }; _mockMethodExecutor.Setup(x => x.ExecuteHooks("AfterSuite", It.IsAny <HooksStrategy>(), It.IsAny <IList <string> >(), It.IsAny <ExecutionContext>())) .Returns(_protoExecutionResult); _mockMethodExecutor.Setup(x => x.GetAllPendingMessages()).Returns(_pendingMessages); _mockMethodExecutor.Setup(x => x.GetAllPendingScreenshotFiles()).Returns(_pendingScreenshotFiles); _executionEndingProcessor = new ExecutionEndingProcessor(_mockMethodExecutor.Object); }
public void Setup() { var mockHookRegistry = new Mock <IHookRegistry>(); var mockSandbox = new Mock <ISandbox>(); mockSandbox.Setup(sandbox => sandbox.GetAllPendingMessages()).Returns(_pendingMessages); var hooks = new HashSet <IHookMethod> { new HookMethod("BeforeSpec", GetType().GetMethod("Foo"), typeof(Step).Assembly) }; mockHookRegistry.Setup(x => x.AfterSuiteHooks).Returns(hooks); var executionEndingRequest = new ExecutionEndingRequest { CurrentExecutionInfo = new ExecutionInfo { CurrentSpec = new SpecInfo(), CurrentScenario = new ScenarioInfo() } }; _request = new Message { MessageId = 20, MessageType = Message.Types.MessageType.ExecutionEnding, ExecutionEndingRequest = executionEndingRequest }; _mockMethodExecutor = new Mock <IMethodExecutor>(); _protoExecutionResult = new ProtoExecutionResult { ExecutionTime = 0, Failed = false }; _protoExecutionResult.Message.AddRange(_pendingMessages); _mockMethodExecutor.Setup(x => x.ExecuteHooks("AfterSuite", It.IsAny <HooksStrategy>(), It.IsAny <IList <string> >())) .Returns(_protoExecutionResult); _executionEndingProcessor = new ExecutionEndingProcessor(_mockMethodExecutor.Object); }
public override Task <ExecutionStatusResponse> FinishExecution(ExecutionEndingRequest request, ServerCallContext context) { return(_pool.Execute(getStream(request.Stream), () => this.executionEndingProcessor.Process(request))); }
public override Task <ExecutionStatusResponse> FinishExecution(ExecutionEndingRequest request, ServerCallContext context) { return(Task.FromResult(this.executionEndingProcessor.Process(request))); }
public override Task <Empty> NotifyExecutionEnding(ExecutionEndingRequest request, ServerCallContext context) { return(Task.FromResult(new Empty())); }