我正在研究单元测试,我想知道是否可以使用 NUnit 测试对话框或表单的某些特殊功能。 .我试过NUnitForms ,但它缺乏良好的文档,而且似乎没有人维护该项目。是真的吗?
如果您有任何测试 Windows 窗体的经验,请指出正确的方法。任何意见或信息表示赞赏。谢谢!
最佳答案
我在使用 NUnitForms 时遇到了同样的问题。我可以启动一个表单并单击一个按钮,但我不知道如何让对话框工作,而且我根本找不到太多相关信息。
我认为这个博客是最有用的:
http://blogs.msdn.com/john_daddamio/archive/2006/11/06/getting-started-with-nunitforms.aspx
我不得不在我的 app.config 中重新映射 NUnitForms 程序集,以使其与最新版本一起使用,如下所示:
<configuration>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="nunit.framework"
publicKeyToken="96d09a1eb7f44a77"
culture="neutral" />
<bindingRedirect oldVersion="2.2.7.0" newVersion="2.5.2.9222" />
</dependentAssembly>
</assemblyBinding>
</runtime>
( http://duncanjasmith.blogspot.com/2007/08/using-nunitforms-with-nunit-framework.html )
我希望这个帖子能帮到我,但我可能仍会尝试白色项目 (http://www.codeplex.com/white)。
关于c# - 使用 NUnit 测试 Windows 窗体逻辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2198454/