[英]MSTest - Running tests using visual studio services (TFS and Continous Integration )
I am following up the below link and setting a CI set up. 我正在跟踪以下链接并设置配置项。
https://blogs.msdn.microsoft.com/visualstudioalm/2015/05/29/testing-in-continuous-integration-and-continuous-deployment-workflows/ https://blogs.msdn.microsoft.com/visualstudioalm/2015/05/29/testing-in-continuous-integration-and-continuous-deployment-workflows/
The issue I am facing here is with respect to the test settings file. 我在这里面临的问题与测试设置文件有关。 The test are running fine locally. 该测试在本地运行良好。 But not remotely when running it, I am getting all test failures. 但是运行它时不是远程的,我遇到了所有测试失败。
I believe this is because of the spreadsheet ( where the test data resides ) and the test settings file. 我相信这是由于电子表格(测试数据所在的地方)和测试设置文件所致。
My test settings file is below 我的测试设置文件如下
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="UITestSettings" id="1623gdcf4-f2af-496f-b65h4-fe25w6c4e49cb" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are default test settings for a remote test run.</Description>
<Deployment>
<DeploymentItem filename="XXX\TestData\LocationData.xls" />
<DeploymentItem filename="XXX\TestData\UITestData.xls" />
</Deployment>
<Execution parallelTestCount="0">
<Timeouts runTimeout="36610000" testTimeout="36610000" />
<TestTypeSpecific>
<UnitTestRunConfig testTypeId="13cdcs9d9-ddb5-4fa4-a97d-d965ccdfc6d4b">
<AssemblyResolution>
<TestDirectory useLoadContext="true" />
</AssemblyResolution>
</UnitTestRunConfig>
<WebTestRunConfiguration testTypeId="4ess7599fa-5ecb-43e9-a887-cd63cfdf72d207">
<Browser name="Internet Explorer 9.0" MaxConnections="6">
<Headers>
<Header name="User-Agent" value="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" />
<Header name="Accept" value="*/*" />
<Header name="Accept-Language" value="{{$IEAcceptLanguage}}" />
<Header name="Accept-Encoding" value="GZIP" />
</Headers>
</Browser>
</WebTestRunConfiguration>
</TestTypeSpecific>
<AgentRule name="LocalMachineDefaultRole">
</AgentRule>
</Execution>
<Properties>
<Property name="TestSettingsUIType" value="UnitTest" />
</Properties>
</TestSettings>
All test failed with this error 所有测试均因此错误而失败
Data source 'XXX.YYY.aboutThemRecommendationFirstQuarterFlows' cannot be found in the test configuration settings 在测试配置设置中找不到数据源“ XXX.YYY.aboutThemRecommendationFirstQuarterFlows”
But I have the settings file in the build steps ( in Run functional Step ) 但是我在构建步骤中有设置文件(在“运行功能步骤”中)
Is there anything I am missing. 有什么我想念的吗? Any help would be great as I am struggling to find a solutions. 当我努力寻找解决方案时,任何帮助都将是巨大的。
Thanks 谢谢
According to the error message, it seems that you are referring to a data source named as "XXX.YYY.aboutThemRecommendationFirstQuarterFlows" which does not exist in "App.config" file test configuration settings. 根据错误消息,您似乎正在引用名为“ XXX.YYY.aboutThemRecommendationFirstQuarterFlows”的数据源,该数据源在“ App.config”文件测试配置设置中不存在。
For example, I have a test method use "MyExcelDataSourceTTT" data source: 例如,我有一个测试方法使用“ MyExcelDataSourceTTT”数据源:
[TestMethod]
[DataSource("MyExcelDataSourceTTT")]
public void TestMethod1()
{
Assert.AreEqual(TestContext.DataRow["1"].ToString(),"1");
}
But in the App.config file, I only have "MyExcelDataSource" data source. 但是在App.config文件中,我只有“ MyExcelDataSource”数据源。 "MyExcelDataSourceTTT" data source does not exist: “ MyExcelDataSourceTTT”数据源不存在:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="microsoft.visualstudio.testtools" type="Microsoft.VisualStudio.TestTools.UnitTesting.TestConfigurationSection, Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</configSections>
<connectionStrings>
<add name="ExcelConnection" connectionString="Dsn=Excel Files;dbq=.\testdata.xlsx;defaultdir=.; driverid=790;maxbuffersize=2048;pagetimeout=5" providerName="System.Data.Odbc" />
</connectionStrings>
<microsoft.visualstudio.testtools>
<dataSources>
<add name="MyExcelDataSource" connectionString="ExcelConnection" dataTableName="Sheet1$" dataAccessMethod="Sequential"/>
</dataSources>
</microsoft.visualstudio.testtools>
</configuration>
Now, when run the testing, you will get "Data source 'MyExcelDataSourceTTT' cannot be found in the test configuration settings.." error message. 现在,在运行测试时,您将收到“在测试配置设置中找不到数据源'MyExcelDataSourceTTT'。”错误消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.