• <tfoot id='jV8u9'></tfoot>

      • <bdo id='jV8u9'></bdo><ul id='jV8u9'></ul>
      <i id='jV8u9'><tr id='jV8u9'><dt id='jV8u9'><q id='jV8u9'><span id='jV8u9'><b id='jV8u9'><form id='jV8u9'><ins id='jV8u9'></ins><ul id='jV8u9'></ul><sub id='jV8u9'></sub></form><legend id='jV8u9'></legend><bdo id='jV8u9'><pre id='jV8u9'><center id='jV8u9'></center></pre></bdo></b><th id='jV8u9'></th></span></q></dt></tr></i><div id='jV8u9'><tfoot id='jV8u9'></tfoot><dl id='jV8u9'><fieldset id='jV8u9'></fieldset></dl></div>
      <legend id='jV8u9'><style id='jV8u9'><dir id='jV8u9'><q id='jV8u9'></q></dir></style></legend>

        <small id='jV8u9'></small><noframes id='jV8u9'>

      1. MSTest 中数据驱动测试的问题

        Problems with data driven testing in MSTest(MSTest 中数据驱动测试的问题)

            1. <tfoot id='967ib'></tfoot>
              <i id='967ib'><tr id='967ib'><dt id='967ib'><q id='967ib'><span id='967ib'><b id='967ib'><form id='967ib'><ins id='967ib'></ins><ul id='967ib'></ul><sub id='967ib'></sub></form><legend id='967ib'></legend><bdo id='967ib'><pre id='967ib'><center id='967ib'></center></pre></bdo></b><th id='967ib'></th></span></q></dt></tr></i><div id='967ib'><tfoot id='967ib'></tfoot><dl id='967ib'><fieldset id='967ib'></fieldset></dl></div>

              <small id='967ib'></small><noframes id='967ib'>

              • <legend id='967ib'><style id='967ib'><dir id='967ib'><q id='967ib'></q></dir></style></legend>

                  <bdo id='967ib'></bdo><ul id='967ib'></ul>
                    <tbody id='967ib'></tbody>
                  本文介绍了MSTest 中数据驱动测试的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 MSTest/Selenium 在 C# 中进行数据驱动测试.这是我尝试设置的一些代码示例:

                  I am trying to get data driven testing to work in C# with MSTest/Selenium. Here is a sample of some of my code trying to set it up:

                  [TestClass]
                  public class NewTest
                  {
                      private ISelenium selenium;
                      private StringBuilder verificationErrors;
                      [DeploymentItem("GoogleTestData.xls")]
                      [DataSource("System.Data.OleDb",
                      "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=GoogleTestData.xls;Persist Security Info=False;Extended Properties='Excel 8.0'",
                      "TestSearches$", DataAccessMethod.Sequential)]
                  
                      [TestMethod]
                      public void GoogleTest()
                      { 
                          selenium = new DefaultSelenium("localhost", 4444, "*iehta", http://www.google.com);
                          selenium.Start();
                          verificationErrors = new StringBuilder();
                          var searchingTerm = TestContext.DataRow["SearchingString"].ToString();
                          var expectedResult = TestContext.DataRow["ExpectedTextResults"].ToString();
                  
                      ...
                  

                  这是我的错误:错误 3 非静态字段、方法或属性 'Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.DataRow.get' 需要对象引用 E:ProjectsSeleniumProjectSeleniumProjectMaverickTest.cs 32 33 SeleniumProject

                  Here's my error: Error 3 An object reference is required for the non-static field, method, or property 'Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.DataRow.get' E:ProjectsSeleniumProjectSeleniumProjectMaverickTest.cs 32 33 SeleniumProject

                  错误是在两个语句的TestContext.DataRow"部分下划线.我真的一直在努力解决这个问题,谢谢!

                  The error is underlining the "TestContext.DataRow" part of both statements. I've really been struggling with this one, thanks!

                  推荐答案

                  试试:

                  public TestContext TestContext { get; set; }
                  

                  并尝试像这样使用它:

                  this.TestContext.DataRow["SearchingString"].ToString();
                  

                  这篇关于MSTest 中数据驱动测试的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  C# namespace alias - what#39;s the point?(C# 命名空间别名 - 有什么意义?)
                  Using Xpath With Default Namespace in C#(在 C# 中使用具有默认命名空间的 Xpath)
                  Generating an EDMX from a DB2 Database(从 DB2 数据库生成 EDMX)
                  IBM .NET Data Provider Connection String issue with Library List(库列表的 IBM .NET 数据提供程序连接字符串问题)
                  .NET DB2 OLEDB pre-requisites(.NET DB2 OLEDB 先决条件)
                  Referring to Code in IBM.Data.DB2 makes that Assembly Unavailable to the rest of my Solution(引用 IBM.Data.DB2 中的代码使该程序集对我的解决方案的其余部分不可用)
                    <tfoot id='I0aO9'></tfoot>

                    <i id='I0aO9'><tr id='I0aO9'><dt id='I0aO9'><q id='I0aO9'><span id='I0aO9'><b id='I0aO9'><form id='I0aO9'><ins id='I0aO9'></ins><ul id='I0aO9'></ul><sub id='I0aO9'></sub></form><legend id='I0aO9'></legend><bdo id='I0aO9'><pre id='I0aO9'><center id='I0aO9'></center></pre></bdo></b><th id='I0aO9'></th></span></q></dt></tr></i><div id='I0aO9'><tfoot id='I0aO9'></tfoot><dl id='I0aO9'><fieldset id='I0aO9'></fieldset></dl></div>

                      • <small id='I0aO9'></small><noframes id='I0aO9'>

                          <bdo id='I0aO9'></bdo><ul id='I0aO9'></ul>
                            <tbody id='I0aO9'></tbody>
                          1. <legend id='I0aO9'><style id='I0aO9'><dir id='I0aO9'><q id='I0aO9'></q></dir></style></legend>