Reputation: 2004
Can someone explain me how it works, starting from when you select to run a test
Upvotes: 2
Views: 3485
Reputation: 136613
When you select to run a test,
That's it in a nutshell. The power of xUnit is its simplicity. Is that what you were looking for ?
Upvotes: 5
Reputation: 1833
1) Have a class you want to test in a .NET project (MyClass is the class name, MyProject is the project name, for example)
2) Add another project to your solution called MyProject.Tests
3) Add a reference from MyProject to MyProject.Tests so that you can access the class you want to test from the testing code
3) In this new project add a new class file called MyClass (the same as the class in MyProject)
4) In that class, add your testing code like this page explains -- http://www.nunit.org/index.php?p=quickStart&r=2.4.8
5) When you've written your tests, build the solution. In the MyProject.Tests project folder a new folder will appear -- 'MyProject.Tests\bin\Debug'. That's assuming you built in Debug mode. If you built in Release mode it'll be MyProject.Test\bin\Release. Either will work. In this folder, you'll find a dll file called MyProject.Tests.dll
6) Open the nUnit testing utility, File > Open, then navigate to the folder in #5 to find that MyProject.Tests.dll. Open it.
7) The tests from the dll should be listed in the nUnit utility window, and you can now select which tests to run, and run them.
Note: The naming convention isn't necessary, it's just the way I do it. If you have a project called 'MyProject' and you want your testing project to be called 'ArbitraryName' instead of 'MyProject.Test', then it'll still work... the naming convention just helps keep track of what exactly is being tested.
Upvotes: 1
Reputation: 786
I use it at work, but I'm not an expert. Here's a link to the NUnit documentation: http://www.nunit.org/index.php?p=getStarted&r=2.4.8
Upvotes: 1
Reputation: 12993
What do you mean how does it work?
You define your test classes with [TestFixture] and your tests with [Test]
It's nothing more than a testing framework, you still have to write the tests and all of that jazz :)
Upvotes: 0