本文介绍了F#下的xUnit测试:您似乎正在尝试执行xUnit.net单元测试(xunit.runner.utility.dll中发生"System.ArgumentException")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Visual Studio 2012 Ultimate, update 3, v.11.0.60610.01
Visual F# 2012 04940-004-0038003-02527
TestDriven.Net 3.5 Beta 3 Personal
1.我在packages.config中拥有什么:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FsUnit.xUnit" version="1.2.1.2" targetFramework="net45" />
<package id="xunit" version="1.9.1" targetFramework="net45" />
</packages>
2.我跑了什么:xunit.installer.exe
3.这就是packages文件夹的样子
2. What I ran: xunit.installer.exe
3. This is what the packages folder looks like
\packages\FsUnit.xUnit.1.2.1.2
\packages\xunit.1.9.1
\packages\repositories.config
\packages\FsUnit.xUnit.1.2.1.2\Lib
\packages\FsUnit.xUnit.1.2.1.2\tools
\packages\FsUnit.xUnit.1.2.1.2\FsUnit.xUnit.1.2.1.2.nupkg
\packages\FsUnit.xUnit.1.2.1.2\FsUnit.xUnit.1.2.1.2.nuspec
\packages\FsUnit.xUnit.1.2.1.2\Lib\Net20
\packages\FsUnit.xUnit.1.2.1.2\Lib\Net40
\packages\FsUnit.xUnit.1.2.1.2\Lib\Net20\FsUnit.CustomMatchers.dll
\packages\FsUnit.xUnit.1.2.1.2\Lib\Net20\FsUnit.CustomMatchers.XML
\packages\FsUnit.xUnit.1.2.1.2\Lib\Net20\FsUnit.Xunit.dll
\packages\FsUnit.xUnit.1.2.1.2\Lib\Net20\FsUnit.Xunit.xml
\packages\FsUnit.xUnit.1.2.1.2\Lib\Net20\NHamcrest.dll
\packages\FsUnit.xUnit.1.2.1.2\Lib\Net40\FsUnit.CustomMatchers.dll
\packages\FsUnit.xUnit.1.2.1.2\Lib\Net40\FsUnit.CustomMatchers.XML
\packages\FsUnit.xUnit.1.2.1.2\Lib\Net40\FsUnit.Xunit.dll
\packages\FsUnit.xUnit.1.2.1.2\Lib\Net40\FsUnit.Xunit.xml
\packages\FsUnit.xUnit.1.2.1.2\Lib\Net40\NHamcrest.dll
\packages\FsUnit.xUnit.1.2.1.2\tools\install.ps1
\packages\xunit.1.9.1\lib
\packages\xunit.1.9.1\xunit.1.9.1.nupkg
\packages\xunit.1.9.1\xunit.1.9.1.nuspec
\packages\xunit.1.9.1\lib\net20
\packages\xunit.1.9.1\lib\net20\xunit.dll
\packages\xunit.1.9.1\lib\net20\xunit.dll.tdnet
\packages\xunit.1.9.1\lib\net20\xunit.installer.exe
\packages\xunit.1.9.1\lib\net20\xunit.runner.msbuild.dll
\packages\xunit.1.9.1\lib\net20\xunit.runner.tdnet.dll
\packages\xunit.1.9.1\lib\net20\xunit.runner.utility.dll
\packages\xunit.1.9.1\lib\net20\xunit.xml
4.我的测试文件:
module MyTesting
open Xunit
open FsUnit.Xunit
[<Fact>]
let ``please work``() = 123
我仍然得到这个:
------ Test started: Assembly: MyTesting.dll ------
It looks like you're trying to execute an xUnit.net unit test.
For xUnit 1.5 or above (recommended):
Please ensure that the directory containing your 'xunit.dll' reference also contains xUnit's
test runner files ('xunit.dll.tdnet', 'xunit.runner.tdnet.dll' etc.)
For earlier versions:
You need to install support for TestDriven.Net using xUnit's 'xunit.installer.exe' application.
You can find xUnit.net downloads and support here:
http://www.codeplex.com/xunit
一个问题:
我在做什么错了?
更新:
这是我在调试模式下运行时的意思:
This is what is says when I run in the debug mode:
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll', Symbols loaded.
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\TestDriven.NET 3\ProcessInvocation86.exe'
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\TestDriven.NET 3\TestDriven.TestRunner.Server.dll'
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Remoting\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Remoting.dll', Symbols loaded.
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll', Symbols loaded.
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\TestDriven.NET 3\TestDriven.TestRunner.dll'
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll', Symbols loaded.
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Symbols loaded.
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Symbols loaded.
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Symbols loaded.
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll'
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll', Symbols loaded.
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\TestDriven.NET 3\TestDriven.Framework.dll'
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\Mine\MyProject\packages\xunit.1.9.1\lib\net20\xunit.runner.tdnet.dll'
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\Mine\MyProject\bin\Debug\MyProject.Testing.dll', Symbols loaded.
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\Mine\MyProject\packages\xunit.1.9.1\lib\net20\xunit.runner.utility.dll'
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'xunit.runner.utility.{Dynamic}'
A first chance exception of type 'System.ArgumentException' occurred in xunit.runner.utility.dll
The thread 'TestRunnerThread' (0x13b0) has exited with code 0 (0x0).
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\TestDriven.NET 3\AdHoc\TestDriven.AdHoc.dll'
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\Mine\MyProject.Testing\bin\Debug\MyProject.Testing.dll', Symbols loaded.
'ProcessInvocation86.exe' (Managed (v4.0.30319)): Loaded 'C:\Mine\MyProject\MyProject.Testing\bin\Debug\xunit.dll'
The thread 'TestRunnerThread' (0x504) has exited with code 0 (0x0).
The program '[1136] ProcessInvocation86.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
推荐答案
我无法对此进行复制.
这是我所做的:
- 打开VS2013,TD.NET 3.5 RC
- 创建一个F#项目,Windows->库(.NET 4.5)
- 从软件包管理器控制台运行"install-package xunit -version 1.9.1"
- 从软件包管理器控制台运行"install-package fsunit.xunit -version 1.2.1.2"
- 将Library1.fs的内容替换为:
module FsTestSample
open Xunit
open FsUnit.Xunit
[<Fact>]
let ``please work``() = 123
我将光标置于"please work"内,然后单击鼠标右键,然后单击"Run Test(s)".运行了测试,并显示以下输出:
I placed the cursor inside "please work" and right clicked, then clicked on "Run Test(s)". The test ran, with this output:
------ Test started: Assembly: FsTestSample.dll ------
1 passed, 0 failed, 0 skipped, took 0.50 seconds (xUnit.net 1.9.1 build 1600).
我什至将"= 123"更改为"= 123/0"只是为了验证测试是否被零除例外所致(确实如此).
I even changed "= 123" to "= 123 / 0" just to verify that the test failed with a divide by zero exception (it did).
这篇关于F#下的xUnit测试:您似乎正在尝试执行xUnit.net单元测试(xunit.runner.utility.dll中发生"System.ArgumentException")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!