【发布时间】:2021-05-14 08:29:13
【问题描述】:
我尝试使用以下命令在命令提示符下运行 flaUiTests:
pathToConsole\nunit3-console.exe pathToApp\App.dll --testparam:App=pathToExecutable\App.exe
在测试代码中,我将 testparam 与以下代码一起使用:
string lParameterPathExecutable = TestContext.Parameters["App"];
我测试了命令提示符是否可以找到所有文件并且他可以。无论如何,我仍然得到错误: System.ComponentModel.Win32Excetion: 系统找不到指定的文件。
有谁知道问题出在哪里?这个命令有什么问题? 测试代码在VisualStudio2019,NUnit3-console版本为3.12.0。
编辑: 可以找到 nunit3 控制台。我认为 nunit3-console 运行。 这是测试结果:
System.ComponentModel.Win32Exception : The system cannot find the file specified
--Win32Exception
The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at NUnit.Engine.Services.TestAgency.CreateRemoteAgent(TestPackage package, Int32 waitTime)
at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunner()
at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
Test Run Summary
Overall result: Failed
Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
Start time: 2021-02-10 21:26:08Z
End time: 2021-02-10 21:26:08Z
Duration: 0.145 seconds
Results (nunit3) saved as TestResult.xml
【问题讨论】:
-
从您的问题来看,尚不清楚是否 (1) nunit3-console 找不到(并且不运行)或 (2) nunit3-console 运行(显示其标题)但随后给出错误找不到某些东西或(3)nunit3-console 运行并且错误来自使用您设置的参数的特定测试。每一个都是不同的潜在问题。
-
@Charlie,我编辑了我的问题并尝试提供更多信息
-
这看起来像 NUnit 控制台无法找到合适的代理来运行。所以我们应该知道你是如何安装 NUnit 控制台(即 nuget、msi 等)的,如果你只是通过复制文件来安装它,它的目录结构是什么样的。您还可以通过运行 --trace=Debug 并检查创建的日志来获得更多信息。
-
@Charlie,这样更好。但是我得到了下一个错误:System.InvalidCastException:无法将透明代理转换为类型“System.Web.UI.ICallBackEventHandler”。我读了一些关于引擎版本的东西。但是引擎的版本已经是3.12.0了。
-
当我将 NUnit 控制台和引擎更改为 3.11.1 版本并将 TestAdapter 更改为 3.17 时,我仍然收到 System.InvalidCastException 错误。
标签: c# command-line nunit flaui