A.D.
A.D.

Reputation: 1452

How to make a .dll and run it with NUnit?

I'am totally new to Windows Store App programming, so i'am also new to Visual Studio Express.

My goal is to test a simpple class method. As mentioned here the Express version do not have any built-in Unit testing. In this thread, Rafal provides a solution.

I exactly did it like described, so my external tools look like this:

enter image description here

When i execute it (Tools --> "Execute NUnit"), Nunit starts and the Gui of NUnit appears. But suddenly this exception occurs:

enter image description here

And in Exception Details:

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)

My project folder has this structure:

enter image description here

The test classes are in "WebTest.Shared".

I think i need a .dll to run in NUnit as mentioned by Jon here. So, how can I make a dll out of my project to run it with NUnit? Can anyone guide me through this problem? (Please step by step)

EDIT:

After i worked in ChrisM idea, the exception stll arises without "${BinDir}${TargetName}.dll/run" block (the exception details are the same as before):

enter image description here

EDIT No. 2:

I have set those values:

Title: Execute NUnit

Command: D:\Path\To\NUnit\bin\nunit.exe

Arguments: $(BinDir)$(TargetDir)$(TargetExt)/run

Initial directory: $(BinDir)

EDIT No. 3:

After closing and reopening VS Express i got this new Exception: newException

And in NUnit Exception Details:

System.ApplicationException: Unable to find test in assembly

System.ApplicationException...

EDIT No. 4

Here is my test class (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"));

        }
    }
}

Upvotes: 0

Views: 1252

Answers (2)

tm1
tm1

Reputation: 1319

Visual Studio 2017 Express (the final express version) includes the test explorer. Add the NUnit3TestAdapter NuGet to your project, and the test explorer should discover your tests.

Upvotes: 0

ChrisM
ChrisM

Reputation: 1168

In external Tools:

Have you tried replacing the curly braces {} in the argument box with normal ones ()?

Upvotes: 0

Related Questions