2014-09-28 67 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添加到您的项目中,并且测试浏览器应该发现您的测试。