带有Dataprovider的Selenium webdriver使用null参数运行每个测试

时间:2017-06-08 07:22:00

标签: selenium-webdriver

我通过使用selenium,TestNG和dataprovider创建了一些测试。 每当测试执行两次时,我会运行测试一次使用参数,第二次使用空参数enter image description here

Please find screenshot for reference

请告诉我如何解决问题。

感谢您的帮助!!

代码: 公共类AppTest_BlankOrder     扩展ReplaceBaseclass {

var server = require('http').createServer(app);
var io = require('socket.io').listen(server);

// ----数据提供者代码----

public ActionResult Index()
{
      //Your original string
      string yourCommaDelimitedString = "TN,KA,KL";

      //Use the String.Split() method to break the string into an array containing all of your values and then
      //convert it to a List using the Enumerable.ToList() method
      List<string> yourValues = yourCommaDelimitedString.Split(',').ToList();

      //Add your values to the ViewData to be bound to a DropDown
      ViewData["Options"] = new SelectList(yourValues);

      return View();
}

1 个答案:

答案 0 :(得分:0)

数据提供者中for循环的计数器应从 0 开始。这就是使data [] []的第一个元素具有空值的原因。

相关问题