问题标签 [nunit-console]

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 投票
2 回答
2344 浏览

nunit - nunit-console 可以列出测试夹具中的所有测试名称吗?

我想在它们运行之前报告它们,并且可以选择通过 shell 脚本运行单个测试而不管理类别。我们有一些非托管代码可能会使进程处于不良状态,有时很乐意在每次 nunit-console 运行时单独运行每个测试。

0 投票
1 回答
1414 浏览

nunit - 有没有办法让 nunit-console 指示其进度?

nunit-console 不会在命令行中提供进度指示器来指示测试已通过或失败,直到所有测试都运行为止。这有点糟糕,因为 rspec 将输出每个通过/失败的测试。

有没有办法让 nunit-console 在运行时指示通过/失败测试?

如果重要的话,我会将多个程序集传递到对 nunit-console 的单个命令行调用中。

0 投票
1 回答
296 浏览

nunit - 如何使用 Psake 清理 NUnit 进程?

我有一个在本地运行良好的 Psake 脚本。它运行良好;但是,Nunit 会启动 nunit-agent.exe 进程并且不会处理它们。

这在本地不是问题,因为我不会在每次构建时都提取我的存储库(包含 Nunit)的新副本。

在拉取新副本的构建服务器上,这会中断,因为与 nunit-agent.exe 关联的文件被锁定并在第一次成功运行后仍在运行。

有没有办法在 nunit 运行后清理进程,或者我应该以不同的方式调用 nunit?

我的 PSake 脚本中的片段:

0 投票
1 回答
792 浏览

nunit - NUnit 控制台所需的最低依赖项是什么?

可能重复:
OSS 项目的最小 NUnit 二进制文件

我想在 TFS 2010 构建服务器上使用此自定义 NUnit 构建活动。它以与构建服务器上的 MSTest 相同的方式运行 NUnit 测试(带有完整报告)。它需要nunit-console.exe在构建服务器上运行,所以我需要把它放在那里。

nunit-console.exe(当前版本 2.6)取决于我需要放在服务器上的最低要求文件是什么?似乎 NUnit 本身带有很多文件,如果我只想运行控制台,这些文件可能并非全部都需要。

0 投票
3 回答
251 浏览

cruisecontrol.net - 即使 Soursecontrol 不可访问,Cruisecontrol 任务也可以执行

我已经部署了 CruiseControl.Net(版本 1.6.7981.1)服务器,它执行以下任务:

  1. 构建触发器
  2. 贴标机
  3. VSTS Soursecontrol 块(从 TFS 2010 服务器获取源代码)
  4. 在调试模式下构建代码
  5. 使用 Nanat 任务运行 NUnit 测试
  6. 合并 NUnit-Result.xml(发布者任务)

由于我每次运行 NUnit 任务之前都需要清除 NUnit-Result.xml 文件,因此我在 Nant.build 文件中添加了一个删除任务,该任务在 NUnit 任务运行之前删除 NUnit-results.xml。

现在我的问题是当我的构建触发时,如果我的 TFS 服务器不可访问,构建失败并且只有发布者任务运行,所以旧 Nunit 结果文件合并到失败的构建中。

我尝试运行“预构建”任务,但它仅在 TFS 服务器可访问时才有效。

现在我想要的是删除 Nunit-result.xml 的任务,即使我的 TFS 不可访问也可以运行(在源控制块之前或发布者块内/之后)

提前致谢

0 投票
1 回答
189 浏览

osx-lion - monocov 没有在(OS X 10.7.4)上生成输出

我正在尝试使用 monocov 来计算单元测试覆盖率并遇到问题,谷歌已经筋疲力尽,但似乎没有相关答案可用。

我按照这个[问题]中显示的提示成功下载并构建了monocov:Can't get monocov to compile (Mac OS x 10.7.4)

曾尝试将 monocov 与 nunit-console2 一起使用,如http://www.mono-project.com/Code_Coverage所示

这是我的命令:

我得到的输出为:

我得到一个 TestResult.xml 是 nunit-console2 的通用输出文件,并且没有任何错误消息,也没有由于 monocov 生成的 .cov 文件。当前卡住并且不知道出了什么问题。

不确定任何关于 monocov 的专家都可以在这里阐明一些观点。谢谢!

0 投票
1 回答
782 浏览

.net - Nunit 不会为程序集中的特定命名空间运行测试

我有包含大量测试的大型程序集。这些测试被分组在不同的命名空间下。我尝试从 nunit-console 运行特定命名空间的测试用例,但没有运行任何测试。这只发生在这个程序集中。它适用于我为测试它而创建的示例测试程序集。

可能是什么原因?有什么限制吗?

我使用的命令行命令如下

nunit-console.exe /noshadow /nothread /run:namespace Absolute_path_of_the_dll

0 投票
1 回答
421 浏览

windows-phone-7 - NUnit 和 Windows Phone 库 (System.TypeLoadException)

我正在尝试使用 NUnit 和标准控制台(GUI 或非 GUI)运行器测试 Windows Phone 7.1 类库。

在我的问题之后,我在下面找到了这个: http ://dotneteers.net/blogs/vbandi/archive/2012/08/08/using-nunit-to-test-windows-phone-7-applications-part- 1.aspx

所以我几乎可以肯定这是我自己的一个愚蠢的问题。

每次我尝试加载我的程序集测试时,我都会收到此错误:

System.TypeLoadException:无法从程序集'mscorlib,版本 = 2.0.0.0,文化 = 中性,PublicKeyToken = b77a5c561934e089' 加载类型'System.Runtime.Versioning.TargetFrameworkAttribute'。

如需更多信息,请使用异常详细信息菜单项。

* 这里是“详细信息” *

System.TypeLoadException...

服务器堆栈跟踪: en System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount) en System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) .Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) en System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] 属性,IList derivedAttributes,RuntimeType& attributeType,RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) en System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 DecorationMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType ) en System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders .TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures, Boolean autoSuites)ctorHasParameters, Boolean& isVarArg) en System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) en System. Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly (程序集程序集、字符串程序集名称、IList 固定装置、布尔自动套件)ctorHasParameters, Boolean& isVarArg) en System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) en System. Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly (程序集程序集、字符串程序集名称、IList 固定装置、布尔自动套件)CustomAttribute.GetCustomAttributes(Module decoratedModule,Int32 decoratedMetadataToken,Int32 pcaCount,RuntimeType attributeFilterType,Boolean mustBeInheritable,IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly 程序集,RuntimeType caType) en System.Reflection.Assembly.GetCustomAttributes(Type attributeType,Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures,布尔自动套件)CustomAttribute.GetCustomAttributes(Module decoratedModule,Int32 decoratedMetadataToken,Int32 pcaCount,RuntimeType attributeFilterType,Boolean mustBeInheritable,IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly 程序集,RuntimeType caType) en System.Reflection.Assembly.GetCustomAttributes(Type attributeType,Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures,布尔自动套件)Boolean mustBeInheritable, IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) en System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit .Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures, Boolean autoSuites)Boolean mustBeInheritable, IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) en System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit .Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures, Boolean autoSuites)ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures, Boolean autoSuites)ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures, Boolean autoSuites)
en NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites) en NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites) en NUnit.Core.TestSuiteBuilder.BuildSingleAssembly(TestPackage package)
en NUnit.Core.TestSuiteBuilder.Build(TestPackage package) en NUnit.Core.SimpleTestRunner.Load(TestPackage package) en NUnit.Core.ProxyTestRunner.Load(TestPackage package) en NUnit.Core.ProxyTestRunner.Load(TestPackage package) en NUnit .Core.RemoteTestRunner.Load(TestPackage package) en System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) en System.Runtime .Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) en System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr , 布尔 fExecuteInContext)

在 [0] 处重新抛出异常: en System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) en System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) en NUnit.Core。 TestRunner.Load(TestPackage package) en NUnit.Util.TestDomain.Load(TestPackage package) en NUnit.Util.TestLoader.LoadTest(String testName)

有人知道我找不到什么问题吗?

0 投票
2 回答
186 浏览

c#-4.0 - 在 Jenkins 和 NUnit 中调试 C#

我需要在詹金斯开始测试 Nunit 之前启动一个调试项目,可以这样做吗?

我有一个包含 15 个项目的解决方案,如果我不开始调试 nunit 所有测试返回错误,我需要调试所有解决方案以便在 nunit 中进行测试

0 投票
1 回答
2939 浏览

opencover - OpenCover - 找不到 PDB

我在让 OpenCover 工作时遇到了一些问题

我有以下文件夹结构

  • \工具
  • \工具\Nunit
  • \工具\OpenCover
  • \构建工件

当我的代码编译时,所有编译后的代码都会生成到 BuildArtifacts 文件夹中。这包括 dll 和相应的 .pdb 文件

我正在努力让 OpenCover 运行

从 powershell 我从根文件夹输入以下命令:

.\tools\OpenCover\OpenCover.Console.exe -register:user -target:.\tools\nunit\nunit-console.exe -targetargs:".\buildartifacts\MVCControllerTests.dll /noshadow" -filter:+[*] * -输出:.\coverage.xml

但是我不断收到消息:提交...

无结果 - 未检测与提供的过滤器匹配的程序集这可能是由于缺少与过滤器匹配的程序集的 PDB 请查看输出文件并参考使用指南 (Usage.rtf)

我查看了OpenCover/NUnit can't find PDB files,并且我的 targetargs 中有 /noshadow 开关

我试图将 /noshadow 移动为 targetargs 中的第一个,但随后我从 nunit 收到错误

我还更新了 nunit-console.exe.config 并将以下行添加到启动节点,以确保所有测试都在 .net4 而不是 .net3.5 中执行

<supportedRuntime version="v4.0.30319">

但这并没有什么不同。

当我查看 coverage.xml 文件时,即使我有 noshadow 标志,nunit 似乎仍然在执行 shadowcopy

例如,这是存在的:

C:\Users\darren\AppData\Local\Temp\nunit20\ShadowCopyCache\10344_634940293912865718\Tests_275832668\assembly\dl3\db34ecee\a0f236ee_a7f4cd01\TABusinessInterface.DLL

感谢任何帮助。