我想在TFS 2015构建服务器(vNext构建)上运行SpecFlow测试(基于MSTest)。该构建将另一个构建的编译工件(从放置位置)加载到其构建代理的源文件夹中,并且其中应包含所有必需的文件:
我正在使用SpecFlow 2.2版。由于公司政策限制,我无法升级到较新版本。
在TFS上执行的命令是:
"c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "E:\...<someDeepPath>..\bin\Debug\Silverstone.XAP.SpecFlowTests.dll" /TestAdapterPath:"."
结果是:
2019-08-29T12:57:00.6767934Z Executing the powershell script: E:\install\agent\tasks\VSTest\1.0.32\VSTest.ps1
2019-08-29T12:57:00.9580544Z ##[debug]Calling Invoke-VSTest for all test assemblies
2019-08-29T12:57:01.0517956Z Working folder: E:\buildsXAPDev\2
2019-08-29T12:57:01.0517956Z Executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe "E:\buildsXAPDev\2\s\XAP\20190829.2\drop\FunktionsTest\XAP.SpecFlowTests\bin\Release\Silverstone.XAP.SpecFlowTests.dll" /TestAdapterPath:"." /logger:trx
2019-08-29T12:57:01.3642905Z Microsoft (R) Test Execution Command Line Tool Version 14.0.25420.1
2019-08-29T12:57:01.3799253Z Copyright (c) Microsoft Corporation. All rights reserved.
2019-08-29T12:57:01.7237111Z Starting test execution, please wait...
2019-08-29T12:57:02.5830384Z Failed TestCase65_EditCustomer
2019-08-29T12:57:02.5830384Z ##[error]Error Message:
2019-08-29T12:57:02.5830384Z ##[error] Class Initialization method Silverstone.XAP.SpecFlowTests.TS_14AuditTrailFeature.FeatureSetup threw exception. System.ArgumentNullException: System.ArgumentNullException: Value cannot be null.
2019-08-29T12:57:02.5830384Z ##[error]Parameter name: configSection.
2019-08-29T12:57:02.5830384Z ##[error]Stack Trace:
2019-08-29T12:57:02.5830384Z ##[error] at TechTalk.SpecFlow.Configuration.AppConfig.AppConfigConfigurationLoader.LoadAppConfig(SpecFlowConfiguration specFlowConfiguration, ConfigurationSectionHandler configSection)
2019-08-29T12:57:02.5830384Z ##[error] at TechTalk.SpecFlow.Configuration.ConfigurationLoader.LoadAppConfig(SpecFlowConfiguration specFlowConfiguration)
2019-08-29T12:57:02.5830384Z ##[error] at TechTalk.SpecFlow.Configuration.ConfigurationLoader.Load(SpecFlowConfiguration specFlowConfiguration)
2019-08-29T12:57:02.5830384Z ##[error] at TechTalk.SpecFlow.Configuration.DefaultRuntimeConfigurationProvider.LoadConfiguration(SpecFlowConfiguration specFlowConfiguration)
2019-08-29T12:57:02.5830384Z ##[error] at TechTalk.SpecFlow.Infrastructure.ContainerBuilder.CreateGlobalContainer(IRuntimeConfigurationProvider configurationProvider)
2019-08-29T12:57:02.5830384Z ##[error] at TechTalk.SpecFlow.TestRunnerManager.CreateTestRunnerManager(Assembly testAssembly, IContainerBuilder containerBuilder)
2019-08-29T12:57:02.5830384Z ##[error] at TechTalk.SpecFlow.TestRunnerManager.GetTestRunnerManager(Assembly testAssembly, IContainerBuilder containerBuilder)
2019-08-29T12:57:02.5830384Z ##[error] at TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(Assembly testAssembly, Nullable`1 managedThreadId)
2019-08-29T12:57:02.5830384Z ##[error] at Silverstone.XAP.SpecFlowTests.TS_14AuditTrailFeature.FeatureSetup(TestContext testContext)
乍一看似乎缺少该部分,但是它在那里:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<specFlow>
<!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
<unitTestProvider name="MsTest" />
</specFlow>
...
...
我不确定这是SpecFlow还是MSTest问题。
任何提示表示赞赏!