问题标签 [testdriven.net]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
1610 浏览

oracle - 集成测试通过 NUnit Gui/Console 失败,但通过 IDE 中的 TestDriven

我正在对带有 NHibernate.Driver.OracleDataClientDriver 驱动程序类的 Oracle 数据库使用 NHibernate。我有一个集成测试,当使用 TestDriven.net 通过 IDE 执行时,它可以正确拉回预期数据。但是,当我通过 NUnit GUI 或控制台运行单元测试时,NHibernate 会抛出一个异常,说它找不到 Oracle.DataAccess 程序集。显然,这会阻止我将集成测试作为 CI 流程的一部分运行。

NHibernate.HibernateException : 找不到程序集 Oracle.DataAccess 中的 IDbCommand 和 IDbConnection 实现。确保程序集 Oracle.DataAccess 位于应用程序目录或全局程序集缓存中。如果程序集在 GAC 中,请使用应用程序配置文件中的元素来指定程序集的全名。*

我尝试通过两种方式使程序集可用,将其复制到 bin\debug 文件夹中并在配置文件中添加元素。同样,当通过 IDE 中的 TestDriven 执行时,这两种方法都有效。通过 NUnit GUI/Console 执行时都不起作用。

NUnit Gui 日志显示以下消息。

21:42:26,377 错误 [TestRunnerThread] ReflectHelper [(null)]- 无法加载类型 Oracle.DataAccess.Client.OracleConnection、Oracle.DataAccess。System.BadImageFormatException:无法加载文件或程序集“Oracle.DataAccess,版本=2.111.7.20,Culture=neutral,PublicKeyToken=89b483f429c47342”或其依赖项之一。试图加载格式不正确的程序。

文件名:“Oracle.DataAccess,版本=2.111.7.20,Culture=neutral,PublicKeyToken=89b483f429c47342”---> System.BadImageFormatException:无法加载文件或程序集“Oracle.DataAccess”或其依赖项之一。试图加载格式不正确的程序。

文件名:“Oracle.DataAccess”

我在 Windows 7 64 位上运行 NUnit 2.4.8、TestDriven.net 2.24 和 VS2008sp1。Oracle 数据提供程序 v2.111.7.20、NHibernate v2.1.0.4。

有没有人遇到过这个问题,更好的是,解决了它?


狡猾,谢谢你的回复。但是,NUnit 测试运行程序使用了正确的配置文件,因为我通过从预期的配置文件中提取一个已知值来进行测试。

我假设这与我的配置有关,特别是一般的 Windows 7 或 64 位版本。我继续在构建服务器(W2k3 服务器)上安装/配置了 Oracle 客户端。我将测试移到构建服务器上并运行上述相同的场景,并且测试在所有情况下都按预期工作。

我通过在其他两个开发人员工作站(具有相同工具集版本的 Win XP 32 位)上运行场景来跟踪这一点,并且测试在所有情况下都按预期工作。

我很困惑,但现在很满意。我可以通过 IDE 运行我的集成测试,也可以通过我们的 CI 自动化在构建服务器上执行它们。现在唯一的问题是我无法在我的开发工作站上测试自动化构建项目。

0 投票
1 回答
1212 浏览

testdriven.net - Testdriven.net 在右键单击上下文菜单中不可用

Testdriven.net在右键上下文菜单中不可用??

0 投票
1 回答
237 浏览

.net - TestDriven.NET 下的测试没有获取更新的 fuslogvw 设置

如果有这个重复,我会支持它,但直到有人为我找到它......这是我今天学到的东西[似乎没有人在博客上写过]条目......

使用 TestDriven.NET,我不断地从以下输出Assembly.Load

警告:程序集绑定日志记录已关闭。

要启用程序集绑定失败日志记录,请将注册表值 >[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) 设置为 1。

注意:有一些与程序集绑定失败日志相关的性能损失。

要关闭此功能,请删除注册表值 [HKLM\Software\Microsoft\Fusion!EnableLog]。

所以我加载了 fuslogvw,因为我在 x64 系统上,甚至尝试了相同的 x64 版本,但无论我重试多少次,都无法让它显示日志。我验证了注册表中的设置,一切似乎都应该是 -EnableLog已设置,但重新运行仍然没有乐趣。

0 投票
1 回答
911 浏览

unit-testing - NUnit,TestDriven.Net:使用部分测试类重复测试结果

我刚刚发现我得到的测试数量是我应该得到的两倍。当测试失败时发现了它,我得到了两次相同的测试失败。同样的测试,同样的一切。让我很困惑,但设法将其缩小到某个部分测试类。

它是一个部分类的原因是我把一个测试类一分为二,只是为了让它更干净一点。被测试的类有一个需要大量测试的方法,我认为将它们放在一个单独的文件中会更干净。但是由于使用了一两个辅助方法,我想我可以将类设为部分,这样两个文件仍然可以访问这些方法。

测试框架是 NUnit,测试是使用 TestDriven.Net 运行的。从单个测试方法(报告通过两个测试而不是一个)、类(通过的测试数量是两倍)和整个测试项目中运行测试。

通过使类不是局部的并且只是复制那些微小的辅助方法(可能将它们移动到单独的辅助类或稍后的东西)来设法解决问题。

现在......为什么会发生这种情况?我以为部分类被编译成一个类?这是一般的部分类、NUnit、Test-Driven.net 还是完全不同的问题?

0 投票
1 回答
844 浏览

resharper - Spec fails when run by mspec.exe, but passes when run by TD.NET

I wrote about this topic in another question.

However, I've since refactored my code to get rid of configuration access, thus allowing the specs to pass. Or so I thought. They run fine from within Visual Studio using TestDriven.Net. However, when I run them during rake using the mspec.exe tool, they still fail with a serialization exception. So I've created a completely self-contained example that does basically nothing except setup fake security credentials on the thread. This test passes just fine in TD.Net, but blows up in mspec.exe. Does anybody have any suggestions?

Update: I've discovered a work-around. After researching the issue, it seems the cause is that the assembly containing my principal object is not in the same folder as the mspec.exe. When mspec creates a new AppDomain to run my specs, that new AppDomain has to load the assembly with the principal object in order to deserialize it. That assembly is not in the same folder as the mspec EXE, so it fails. If I copied my assembly into the same folder as mspec, it works fine.

What I still don't understand is why ReSharper and TD.Net can run the test just fine? Do they not use mspec.exe to actually run the tests?

0 投票
1 回答
1082 浏览

.net - 为什么 NUnit 从命令行挂起,而不是在 TestDriven.NET 下?

如果我在 VS2008 下从 TestDriven.NET 开始我的单元测试,它们几乎可以立即运行。

如果我使用 开始我的单元测试nunit-console.exe,NUnit 控制台会在实际运行我的测试之前挂起五分钟。如果我附加一个调试器,它似乎将时间花在调用 by 的一些本地管理转换的另一侧System.IO.MemoryStream.Read,调用 from System.Runtime.Serialization.Formatters,调用 from 。有时,它在or中。System.Runtime.RemotingNUnit.Core.ProxyTestRunner.Test.getSystem.Runtime.Serialization.ObjectManager.RecordFixup.FindObjectHolder

这是 32 位 XP 上的 NUnit-2.5.2,已完全修补。所有程序集都面向 .NET 2.0。

怎么 nunit-console?有没有办法说服它不要这样做?

0 投票
1 回答
286 浏览

testdriven.net - TestDriven.net NCover 问题

我无法运行 NCover。我得到错误:

NCover 无法创建覆盖率报告

我正在通过 TestDriven.net 运行它。我正在使用 MSTest 并且还安装了 resharper 4.2。测试没有问题,因为它适用于同事机器。任何想法是什么问题?

0 投票
1 回答
520 浏览

unit-testing - Gallio TestDriven.Net 测试问题

我有一个 tdd 系统,我使用 Gallio 3.1 和 TestDriven.Net。我已经为他们下载了补丁。

1) 我得到了这个堆栈并且测试不会停止 - SRCSRV: cmd /c svn.exe cat " http://mb-unit.googlecode.com/svn/branches/v3.1/src/Gallio/ Gallio/Framework/Pattern/PatternTestInstanceState.cs@2360" --non-interactive > "C:\DOCUME~1\tzvik\LOCALS~1\APPLIC~1\SOURCE~1\svn\branches\v3.1\src\Gallio\Gallio\Framework\Pattern\PatternTestInstanceState.cs \2360\patterntestinstancestate.cs" 'svn.exe' 不是内部或外部命令、可运行程序或批处理文件。SRCSRV:源服务器无法检索文件'c:\RelEng\Projects\MbUnit v3 的源代码。 1\Work\src\Gallio\Gallio\Framework\Pattern\PatternTestInstanceState.cs'在模块'C:\Program Files\Gallio\bin\Gallio.dll'中。系统找不到指定的文件。线程'Simple Test Driver ' (0xb84) 已退出,代码为 0 (0x0)。'ProcessInvocation.exe'(托管):已加载 'C:\Program Files\Gallio\bin\Gallio.Reports.dll',已加载符号。'ProcessInvocation.exe'(托管):已加载 'vkcfotcv''ProcessInvocation.exe'(托管):加载'C:\WINDOWS\assembly\GAC_MSIL\System.Data.SqlXml\2.0.0.0__b77a5c561934e089\System.Data.SqlXml.dll''ProcessInvocation.exe'(托管):已加载“System.Xml.Xsl.CompiledQuery.1”“ProcessInvocation.exe”(托管):已加载“System.Xml.Xsl.CompiledQuery”

在最后一行之后,它只是在一些我无法理解的循环中拖拽......我该如何解决这个问题?

2) 我从 Gallio 那里得到一些试用,以找到一些丢失的文件?cmd /c svn.exe cat " http://mb-unit.googlecode.com/svn/branches/v3.1/src/Gallio/Gallio/Framework/Pattern/PatternTestInstanceState.cs@2360 " --non-interactive > "C:\DOCUME~1\tzvik\LOCALS~1\APPLIC~1\SOURCE~1\svn\branches\v3.1\src\Gallio\Gallio\Framework\Pattern\PatternTestInstanceState.cs\2360\patterntestinstancestate.cs"有时也会在弹出窗口中..有人有这样的消息还是我那么“特别”?谢谢,人们!

0 投票
0 回答
990 浏览

nunit - How to setup Binding redirect with Nunit's gui runner?

I am trying to run my unit tests with nHibernate 3 and fluentnHibernate, To do this I need to setup a assembly binding redirect so fluentnHibernate will work with the new version of nHibernate. I have tried to update my test project's app.config however the testdriven.net runner and the nunit gui runner don't seem to read these settings.

below is my test.dll's app.config.

I am getting the following error:

TestCase 'FieldGuideTests.Service.SchemaFacts.Can_Build_SQL_Schema' failed: System.IO.FileLoadException : Could not load file or assembly 'NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at FieldGuideService.SessionFactoryManagers.SQL_SessionFactoryManager.CreateSessionFactory()

0 投票
1 回答
163 浏览

c# - NUnit / Testdriven.Net 冲突的结果

当我在 NUnit = Red Bar 中运行此测试时。

但是,当我在 Visual Studio 中使用 Testdriven.Net 运行此测试时,它通过了(从控制台应用程序运行时也可以)。

当 NUnit 失败时,这是因为 PropertyChanged 为空,subjectVM 是从基类继承 PropertyChanged 的​​视图模型类。

我应该受到责备,还是我在看 NUnit 错误?