数据驱动的MsTest - 测试始终显示已中止

时间:2016-06-22 08:21:50

标签: mstest

我认为对于数据驱动测试的连接字符串并将其添加到app.config非常简单。这是我在测试中的原始DataSource属性:

[DataSource("System.Data.SqlClient", "MyConnectionString", "MyTable", DataAccessMethod.Sequential)]

完美无缺。现在我将它添加到app.config文件中:

<configuration>
  <configSections>
    <section name="microsoft.visualstudio.testtools" type="Microsoft.VisualStudio.TestTools.UnitTesting.TestConfigurationSection, Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
  </configSections>
  <connectionStrings>
    <add name="Portal" connectionString="SameConnectionStringAsAbove" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <microsoft.visualstudio.testtools>
    <dataSources>
      <add name="MyDataSource" connectionString="Portal" dataTableName="MyTable" dataAccessMethod="Sequential"/>
    </dataSources>
  </microsoft.visualstudio.testtools>
</configuration>

将测试中的数据源更改为:

[DataSource("MyDataSource")]

现在,当我运行测试时,它们只显示为已中止 - 没有错误,输出窗口中没有信息。没什么...

1 个答案:

答案 0 :(得分:0)

如果其他人遇到此问题,请回答。只需将视觉效果改为10:

<div class="hoverText card-body row text-center" ng-if="showCase.persons.length != 0" ng-repeat="person in showCase.persons" ng-mouseover="showHover(person)" ng-mouseleave="hideHover(person)">
  <a class="userlist" href="#" ng-click="getProfile(person)">
    <div class="hoverText">
      <div class="col-md-1 col-xs-1 text-medium text-center">
        <img class="img-circle size-1" ng-src="{{person.profile.image_url}}" alt="">
      </div>

      <div class="col-md-2 col-xs-2 text-medium">{{person.mobile_number}}</div>
      <div class="col-md-2 col-xs-2 text-medium">{{person.profile.name+ ' ' +person.profile.lastname}}</div>
      <div class="col-md-1 col-xs-1 text-medium" ng-if="person.profile.gender == 0">Male</div>
      <div class="col-md-1 col-xs-1 text-medium" ng-if="person.profile.gender == 1">Female</div>
      <div class="col-md-2 col-xs-2 text-medium">{{person.profile.email}}</div>
    </div>
  </a>

  <div class="col-md-2 col-xs-2 no-padding">
    <button type="button" class="btn ink-reaction text-bold" ng-class="checkStatus(person.isSuspended)? 'btn-danger':'btn-success'" ng-click="person.isSuspended = suspendUser(person.uname,!person.isSuspended)">{{suspendText}}</button>
  </div>

  <div ng-show="person.hoverIcons">
    <div class="messagebtn btn btn-default style-transparent btn-raised" id="message" data-toggle="modal" data-target="#formModal">
      <i class="md-message"></i>
    </div>

    <div class="mailbtn btn btn-default style-transparent btn-raised" id="email" data-toggle="modal" data-target="#formModal">
      <i class="md-email"></i>
    </div>

    <div class="allotbtn btn btn-default style-transparent btn-raised" id="allotforecasts" data-toggle="modal" data-target="#allotforecast">
      <i class="md-add-circle-outline"></i>
    </div>
  </div>
</div>