Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i Unit Test a single [Test] method in MonoDevelop?

So i'm using MonoDevelop (for some MonoTouch R&D) and have a Unit Testing class library using NUnit.

I have a single [TestFixture] and a couple of [Test] classes. I can run all the tests in one single go .. but i have no idea how i can DEBUG (as in, breakpoint + step through) an individual one.

How can I do this, please?

like image 764
Pure.Krome Avatar asked Mar 20 '12 11:03

Pure.Krome


People also ask

How do I run a single unit test in Visual Studio?

Run tests in Test Explorer If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer (or press Ctrl + E, T). As you run, write, and rerun your tests, the Test Explorer displays the results in a default grouping of Project, Namespace, and Class.

Should a unit test only test one thing?

This guideline is much more aggressive and recommended if you work in a test driven manner rather than write the tests after the code has been written. The main goal here is better code coverage or test coverage.


1 Answers

If you have a regular NUnit test class library in MonoDevelop, you should be able to use the Mono Soft Debugger on individual tests.

In the Unit Tests tab, select the test that you want to debug and right-click on the test. Select Run Test With > Mono Soft Debugger:

enter image description here

Now, you should be able to step through the test code as desired:

enter image description here

This has been tested on a recent version, 3.0, of MonoDevelop.

like image 73
Anders Gustafsson Avatar answered Oct 06 '22 18:10

Anders Gustafsson