Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
User interface 长度不能小于零。(NUNIT GUI RUNNER)_User Interface_Nunit_Runner - Fatal编程技术网

User interface 长度不能小于零。(NUNIT GUI RUNNER)

User interface 长度不能小于零。(NUNIT GUI RUNNER),user-interface,nunit,runner,User Interface,Nunit,Runner,我正在使用NUnit GUI Runner执行在Selenium Webdriver C中开发的测试套件 每次我得到的错误长度不能小于零 如果我用绝对路径更改相对路径,那么它工作正常。那么相对路径是否有任何限制呢。请告知 NUNIT版本:2.6.4.14350 框架版本:NET3.5 Visual Studio 2013 我的代码如下: 字符串relativePath=Path.GetDirectoryNameAssembly.getExecutionGassembly.Location; re

我正在使用NUnit GUI Runner执行在Selenium Webdriver C中开发的测试套件

每次我得到的错误长度不能小于零

如果我用绝对路径更改相对路径,那么它工作正常。那么相对路径是否有任何限制呢。请告知

NUNIT版本:2.6.4.14350 框架版本:NET3.5 Visual Studio 2013

我的代码如下:

字符串relativePath=Path.GetDirectoryNameAssembly.getExecutionGassembly.Location; relativePath=relativePath.Substring0,relativePath.IndexOfTestResults


因此,如果我将relativePath的值更改为C:\demo\则它工作正常。

最有可能的情况是,relativePath不包含TestResults子字符串,因此IndexOf调用返回-1。子字符串调用不能接受负值作为子字符串的第二个参数长度。

谢谢您的回复,但TestResults文件夹在那里,因此子字符串没有问题。事实上,当我在Watch部分添加代码时,它返回的值为68。问题已解决。更新了我的代码并包含Math.Max。relativePath=relativePath.Substring0,Math.Max0,relativePath.IndexOfTestResults;