Nunit 无法启动我的应用程序

发布于 2024-10-05 00:55:23 字数 685 浏览 9 评论 0 原文

Visual Studio 2010 Express C#、NUnit 2.5.8、White 0.2.0

我正在尝试使用 NUnit + White 框架编写一些测试。 我可以毫无问题地启动和运行 White 演示 (ListBoxExample)。

但是当我为自己的应用程序(.Net 4.0)编写一个简单的测试时,我有两个问题:

  1. Application.Launch(""): 这个声明没有抱怨,但根本没有启动我的应用程序。路径是正确的,因为如果我输入的路径不正确,则会收到错误消息。如果路径正确,则不会出现错误,但没有应用程序启动。

  2. application.GetWindow(...) 此语句会导致错误:

DocBackupTestSuite.Tests.StartupTest:System.IO.FileLoadException:可以 不加载文件或程序集“Bricks”, 版本=1.0.0.0,文化=中立, PublicKeyToken=null' 或其之一 依赖关系。所在的程序集 清单定义不匹配 装配参考。 (例外情况来自 HRESULT:0x80131040)

但是我的项目中引用了 Bricks.dll 文件...

谢谢您的帮助

Davy

Visual Studio 2010 Express C#, NUnit 2.5.8, White 0.2.0

I am trying to write some tests with the NUnit + White framework.
I can get the White demo (ListBoxExample) up and running without problems.

But when I write a simple test for my own application (.Net 4.0), I have 2 problems:

  1. Application.Launch(""):
    This statement does not complain, but does NOT launch my application at all. The path is correct because if I put an incorrect path, I get an error. With the right path there are no errors, but no application is starting.

  2. application.GetWindow(...)
    This statement causes an error:

DocBackupTestSuite.Tests.StartupTest: System.IO.FileLoadException : Could
not load file or assembly 'Bricks,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its
dependencies. The located assembly's
manifest definition does not match the
assembly reference. (Exception from
HRESULT: 0x80131040)

But the Bricks.dll file IS referenced in my project...

Thank you for your help

Davy

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

浅笑依然 2024-10-12 00:55:23

第一个问题解决了。

该代码没有等待足够长的时间来为应用程序启动留出时间。
在Application.Launch()语句后添加了Thread.Sleep(10000),现在它启动了。

第二个问题仍然悬而未决...
有人吗?

First problem is solved.

The code did not wait long enough to leave time for the application to start.
Added a Thread.Sleep(10000) after the Application.Launch() statement, and now it starts up.

2nd problem is still pending...
Anyone?

那一片橙海, 2024-10-12 00:55:23

第二个问题也解决了:

缺少对 Bricks.RuntimeFramework 的引用。
添加此后,我的测试运行良好;)

2nd problem also solved:

A reference to Bricks.RuntimeFramework was missing.
After adding this, my test runs fine ;)

旧时光的容颜 2024-10-12 00:55:23

如果您在使用UI自动化库(White-project)时遇到以下问题,

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Bricks, 
Version=1.0.0.0, Culture=neutral, PublicKeyToken=83a26c96fb92c77f' or one of its dependencies.   
The system cannot find the file specified.
File name: 'Bricks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=83a26c96fb92c77f'

请采取以下解决方案:

添加dll列表的引用如下:

•Bricks

•Bricks.RuntimeFramework

•Castle.Core

•Castle.DynamicProxy2

•log4net

• nunit.framework

•White.NUnit

•Xstream.Core

希望您的代码现在可以成功运行。

在此处下载这些内容

http://white-project.googlecode.com/svn/ tag/0.20/lib/

参考自http://sunshinetoast.com/Default.aspx

If you face this problem below when you use the UI automation library(White-project)

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Bricks, 
Version=1.0.0.0, Culture=neutral, PublicKeyToken=83a26c96fb92c77f' or one of its dependencies.   
The system cannot find the file specified.
File name: 'Bricks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=83a26c96fb92c77f'

please take the following solution:

Add Reference of the dll list as follow:

•Bricks

•Bricks.RuntimeFramework

•Castle.Core

•Castle.DynamicProxy2

•log4net

•nunit.framework

•White.NUnit

•Xstream.Core

Hope your code can be work successfully now.

Download theses stuff here

http://white-project.googlecode.com/svn/tags/0.20/lib/

Reference fromhttp://sunshinetoast.com/Default.aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文