gpt4 book ai didi

nunit - 使用 WinForms 和 NUnit 进行自动测试

转载 作者:行者123 更新时间:2023-12-04 06:58:45 26 4
gpt4 key购买 nike

我正在使用 Cruise Control.NET 和 NAnt 在我们的代码库上自动运行 NUnit 测试。某些测试会导致显示 Windows 窗体。当这些测试从 VS 或 NUnit GUI 手动运行时,它们工作正常。通过 Cruise Control 服务运行时,出现以下异常:

System.InvalidOperationException : Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

除了完全排除测试或重写测试以便不显示表单之外,还有其他方法可以修改测试或让 NUnit 在从服务调用时运行这些测试吗?

最佳答案

您可以始终登录用户,并将服务附加到用户 session ( how to create interactive services )。但是,如果你修改你的代码和测试会更好,所以 winform 的东西是抽象的。

关于nunit - 使用 WinForms 和 NUnit 进行自动测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2210538/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com