C#学习教程:无法在Teamcity上启动c#+ SeleniumWebDriver + Specflow + Nunit测试分享


无法在Teamcity上启动c#+ SeleniumWebDriver + Specflow + Nunit测试

现在尝试使用Teamcity服务器运行我的Selenium测试。 服务器在本地安装。 此时团队城市中的项目包含3个步骤:

  1. NuGet instaler。
  2. 使用Visual Studio作为跑步者。
  3. 以NUnit作为跑步者。

此时,第1步和第2步成功完成。 第3步失败,日志中有下一条记录:

[Step 3/3] Volvo.DigitalCommerce.AutomatedTests.dll (9m:11s) [15:02:26][Volvo.DigitalCommerce.AutomatedTests.dll] Volvo.DigitalCommerce.AutomatedTests.Features.ChildSeat.CS_BaseFlowFeature.CS_GoingThroughFullFlow on Chrome (1m:01s) [15:03:28][Step 3/3] Starting ChromeDriver 2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4) on port 6915 [15:03:28][Step 3/3] Only local connections are allowed. [15:03:28] [Volvo.DigitalCommerce.AutomatedTests.Features.ChildSeat.CS_BaseFlowFeature.CS_GoingThroughFullFlow on Chrome] [Test Error Output] -> warning: The previous ScenarioContext was already disposed. [15:03:28] [Volvo.DigitalCommerce.AutomatedTests.Features.ChildSeat.CS_BaseFlowFeature.CS_GoingThroughFullFlow on Chrome] TearDown method failed. Autofac.Core.DependencyResolutionException : An exception was thrown while invoking the constructor 'Void .ctor()' on type 'ChromeDriver'. ---> The HTTP request to the remote WebDriver server for URL http://localhost:6896/session timed out after 60 seconds. (See inner exception for details.) ----> OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:6896/session timed out after 60 seconds. ----> System.Net.WebException : The request was aborted: The operation has timed out. TearDown : System.NullReferenceException : Object reference not set to an instance of an object. [15:03:28] [Volvo.DigitalCommerce.AutomatedTests.Features.ChildSeat.CS_BaseFlowFeature.CS_GoingThroughFullFlow on Chrome] TearDown method failed. Autofac.Core.DependencyResolutionException : An exception was thrown while invoking the constructor 'Void .ctor()' on type 'ChromeDriver'. ---> The HTTP request to the remote WebDriver server for URL http://localhost:6896/session timed out after 60 seconds. (See inner exception for details.) ----> OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:6896/session timed out after 60 seconds. ----> System.Net.WebException : The request was aborted: The operation has timed out. TearDown : System.NullReferenceException : Object reference not set to an instance of an object. at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) at Autofac.Core.Container.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) at Autofac.ResolutionExtensions.ResolveNamed[TService](IComponentContext context, String serviceName, IEnumerable`1 parameters) at Volvo.DigitalCommerce.AutomatedTests.Features.ChildSeat.CS_BaseFlowFeature.CS_GoingThroughFullFlow(String browser) in C:TeamCitybuildAgentworkd7512e1031e4b296Volvo.DigitalCommerce.AutomatedTestsFeaturesChild SeatCS_BaseFlow.feature.cs:line 0 --WebDriverException at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options) at lambda_method(Closure , Object[] ) at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() --WebException at System.Net.HttpWebRequest.GetResponse() at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) --TearDown at Volvo.DigitalCommerce.AutomatedTests.Features.ChildSeat.CS_BaseFlowFeature.ScenarioTearDown() in C:TeamCitybuildAgentworkd7512e1031e4b296Volvo.DigitalCommerce.AutomatedTestsFeaturesChild SeatCS_BaseFlow.feature.cs:line 0 [15:03:28][Volvo.DigitalCommerce.AutomatedTests.dll] Volvo.DigitalCommerce.AutomatedTests.Features.DigitalCommerce.FullFlowTestFeature.DC_FullFlow on Chrome (1m:01s) 

谁能帮助解决这个错误? 在此先感谢,Valentin。

我们的自动化测试套件由于同样的原因而失败,在昨天尝试多个解决方案后,我们的团队将此问题追溯到Teamcity Build Agent Service :在系统帐户下运行的事实。 这通常不是问题,但在我们的案例中,Chrome在本地系统帐户下运行时无法运行/打开。

当我们在CI服务器上手动运行NUnit并且没有遇到问题时,这被certificate是个问题。

更新服务后使用新的用户帐户 (密码永不过期,无法登录)

并在我们构建引用的每个文件夹的安全设置下添加了新用户(除非您将其设置为管理员),Chromedriver能够正确初始化并且套件正常运行。

我们仍然不知道为什么Chrome在本地系统帐户下运行时无法初始化的根本问题,但我们猜测它与Chrome有关,需要一些只有用户帐户的文件夹或文件(桌面,App_Data等) …)

上述就是C#学习教程:无法在Teamcity上启动c#+ SeleniumWebDriver + Specflow + Nunit测试分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—猴子技术宅(www.ssfiction.com)

本文来自网络收集,不代表猴子技术宅立场,如涉及侵权请点击右边联系管理员删除。

如若转载,请注明出处:https://www.ssfiction.com/ckf/1031991.html

发表评论

邮箱地址不会被公开。 必填项已用*标注