BlueM.DLLAdapterTest: Difference between revisions

From BlueM
Jump to navigation Jump to search
m (added the nav bar)
(add section about reference to nunit.framework and change recommendation to install the msi)
Line 2: Line 2:
'''BlueM.DLLAdapterTest''' is an assembly for running unit tests for [[BlueM.Sim]] and [[BlueM.DLLAdapter]] using [http://nunit.org NUnit].
'''BlueM.DLLAdapterTest''' is an assembly for running unit tests for [[BlueM.Sim]] and [[BlueM.DLLAdapter]] using [http://nunit.org NUnit].


==Getting NUnit==
==Installing NUnit==
To run the tests, you need to first [http://nunit.org/download/ download NUnit]. Currently only NUnit version 2 is supported. The simplest way is to download the zip-package (e.g. NUnit-2.6.4.zip) and extract it to a suitable location your computer.
[[File:NUnit_reference.png|thumb|right|200px|Reference to nunit.framework]]
To run the tests, you need to first install NUnit. Currently only NUnit version 2 is supported. The simplest way is to download the msi-package (NUnit-2.6.4.msi) and install it on your computer.
 
In Visual Studio, make sure that the reference to <code>nunit.framework</code> in the assembly IHWB.DLLAdapterTest has been found (no warning triangle). Otherwise, you may have to remove and re-add the reference.<br clear="both"/>


==Running tests==
==Running tests==

Revision as of 02:38, 20 July 2017

BlueM_icon.png BlueM.Sim | Downloads | Application | Theory | Development

BlueM.DLLAdapterTest is an assembly for running unit tests for BlueM.Sim and BlueM.DLLAdapter using NUnit.

Installing NUnit

Reference to nunit.framework

To run the tests, you need to first install NUnit. Currently only NUnit version 2 is supported. The simplest way is to download the msi-package (NUnit-2.6.4.msi) and install it on your computer.

In Visual Studio, make sure that the reference to nunit.framework in the assembly IHWB.DLLAdapterTest has been found (no warning triangle). Otherwise, you may have to remove and re-add the reference.

Running tests

Screenshot of NUnit with the test assembly loaded

Once you have NUnit, execute nunit-x86.exe and then click on File - Open Project and and select the file IHWB.BlueM.DLLAdapterTest.dll, which you should have gotten by compiling the BlueM.DLLAdapterTest assembly. This will cause all tests contained in the assembly to be listed in the left pane (see screenshot).

You can now run all or only selected tests. Ideally, all tests should pass.

Debugging tests

NUnit solutionexplorer.png
Screenshot of the Visual Studio property pages of NUnit

It is also possible to debug tests from within Visual Studio.

First, make sure that nunit.exe is is listed as a project in the solution explorer. If it isn't, add it or check out from the Meta repository to get a solution file already containing NUnit.

Then edit the properties of the nunit.exe-project and make sure that the Command and Working Directory are set correctly (see screenshot).

To start NUnit with debugging functionality, right-click on nunit.exe in the solution explorer and select Debug - Start new instance. The NUnit GUI will appear, where you need to load IHWB.BlueM.DLLAdapterTest.dll as the project and can then run the tests with debugging enabled.