简体   繁体   中英

Running a particular TestFixture class using NUnit tool

I have implemented unit tests for my MVC Application using the NUnit Framework. The Unit testing project contains multiple [TestFixture] classes that need to be tested. I'm using a TestFixture for each Module in my MVC project, but all of the modules are inside in single Namespace.

I would like to be able to test a single Module through its [TestFixture] using the Unit Tool in FinalBuilder (automation) or Manually, instead of testing the whole unit test project.

My total test case count is around 2000, made up of 20 modules each with about 100 test cases. Any changes made to one of modules or it's TestFixture will mean that only that modules tests need to be run. This will minimise the amount of time that needs to be taken to wait for unrelated tests to complete.

As far as manual testing goes, in the Nunit gui, you can simply select a test fixture and run it to. I haven't used finalbuilder, but assuming it's similar to the nunit-console application, you have a couple of options.

You can pass arguments to specify particular test cases, for example:

nunit-console some.dll /run=SomeTestFixture

Or, you can mark up your test fixtures with categories and then tell the test runner to only include tests in those categories, so in your code:

[TestFixture]
[Category("SomeTestCategory")]
public class SomeTestClass {

Then in your nunit call:

nunit-console some.dll /include=SomeTestCategory

That said, assuming that your tests are actually unit tests, 2000 doesn't seem like that many and they shouldn't really be taking all that long to run...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM