MSTest data driven Test set DisplayName for Rows from DataSource

白昼怎懂夜的黑 提交于 2019-12-23 07:06:04

问题


How can I set the DisplayName of a Data Row in data driven tests, where the data source is a XML and the provider is Microsoft.VisualStudio.TestTools.DataSource.XML.

XML:

<?xml version="1.0" encoding="utf-8" ?>
<environments>
    <environment><name>IE</name></environment>
    <environment><name>Chrome</name></environment>
</environments>

App Config:

<!-- CONNECTION STRINGS SETTINGS -->
<connectionStrings>
    <add name="IE_Chrome" connectionString="IE_Chrome.xml" providerName="Microsoft.VisualStudio.TestTools.DataSource.XML"/>
</connectionStrings>
<!-- PARAMETERIZING TEST SETTINGS -->
<microsoft.visualstudio.testtools>
    <dataSources>
        <add name="IE_Chrome" connectionString="IE_Chrome" dataTableName="environment" dataAccessMethod="Sequential"/>
    </dataSources>
</microsoft.visualstudio.testtools>

The Output:

I'd like to display the Environment Name instead of "Data Row 0".

来源:https://stackoverflow.com/questions/19924659/mstest-data-driven-test-set-displayname-for-rows-from-datasource

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!