2014-09-28 62 views
0

我是全新的Windows商店應用程序編程, 因此我也是Visual Studio Express的新手。如何製作.dll並使用NUnit運行它?

我的目標是測試一個simpple類的方法。 如上述here Express版本沒有任何內置單元測試。 在這thread,拉法爾提供solution

我正好也喜歡它說明,所以我的外部工具是這樣的:

enter image description here

當我執行它(工具 - >「執行NUnit的」),NUnit的開始和NUnit的桂出現。但突然出現這種異常:

enter image description here

而且在異常詳細信息:

System.IO.FileNotFoundException... 

    at NUnit.Util.ProjectService.WrapAssembly(String assemblyPath) 

    at NUnit.Util.ProjectService.ConvertFrom(String path) 

    at NUnit.Util.ProjectService.LoadProject(String path) 

    at NUnit.Util.TestLoader.LoadProject(String filePath, String configName) 

我的項目文件夾中有這樣的結構:

enter image description here

的測試類是「WebTest的。共享」。

我想我需要一個.dll在NUnit中運行,如Jon here所述。 那麼,我如何才能使我的項目中的一個DLL與NUnit一起運行? 任何人都可以指導我解決這個問題嗎? (請一步一步)

編輯:

後,我在聖油的想法工作,異常stll沒有出現 「$ {BINDIR} $ {}的TargetName .dll文件/運行」 擋(異常的詳細信息是相同的前):

enter image description here

EDIT 2:

個我已經設置這些值:

標題:執行NUnit的

命令: d:\路徑\爲\ NUnit的\ BIN \ nunit.exe

參數: $(BINDIR )$(TARGETDIR)$(TargetExt)/運行

初始目錄: $(BINDIR)

編輯號3:

關閉並重新打開VS快遞 後我得到這個新的異常: newException

而且在NUnit的異常詳細信息:

System.ApplicationException:無法組裝找到測試

System.ApplicationException ...

編輯編號4

這裏是我的測試類(StringUtilitiesTest.cs):

using System; 
using System.Collections.Generic; 
using System.Text; 
using WebappTest.Shared.Utilities; 
using NUnit.Framework; 

namespace WebappTest.UnitTest 


{ 
    [TestFixture] 
    public class StringUtilitiesTest 
    { 

     [Test] 
     public void TransferFunds() 
     { 

      Assert.AreEqual("Hello", StringUtilites.getString("Hello")); 

     } 
    } 
} 
+0

對我沒有提示? – 2014-10-02 08:23:48

回答

0

在外部工具:

您是否嘗試過與正常的人替換參數框中的大括號{}()?

+0

thx提示但它不起作用,請參閱我更新的答案。 – 2014-10-03 08:26:23

+0

您可以發佈「Argumente」字段的內容嗎? – ChrisM 2014-10-09 13:37:51

+0

我更新了我的問題...... – 2014-10-10 08:42:36

0

Visual Studio 2017 Express(最終快速版)包含測試瀏覽器。將NUnit3TestAdapter NuGet添加到您的項目中,並且測試瀏覽器應該發現您的測試。