I am trying to find a way to create custom suites of NUnit tests to target our wide variety of environments. The closest thing I found was this http://nunit.org/docs/2.5.6/suite.html which is exactly what I am looking for. Tying to implement this though, the [Suite] annotation doesnt even seem to exist.. Was this taken away? Is there a better solution now?
2 Answers
The SuiteAttribute
was eliminated in NUnit 3. It never got a lot of use as most people simply organize their tests by namespace, which provides the same grouping of tests that the SuiteAttribute
used to do.
FUN FACT: "Automatic namespace suites" were once a new cool thing!
If you want the ability to group tests in different ways, across namespace boundaries, you can use categories to do it. It's not as easy of course.
An alternative, if you are using the command-line console runner, is to list the fixtures you want to run in a file and use the --testlist
option.

- 12,928
- 1
- 27
- 31
-
I am using the command-line console runner so the latter recommendation sounds about right! Do you have any examples or documentation of how the file should be structured and set up for this? Thank you! – Tree55Topz Jan 25 '18 at 14:56
-
I see it specified here : https://github.com/nunit/docs/wiki/NUnitLite-Options. However for the file I am to be pointing to, how is this structured? Is it literally just the test names one at a time? Is the file a text file? – Tree55Topz Jan 25 '18 at 15:52
-
I added a testlist.txt file, pointed to it and it recognized the command, however it just said all passed and the test never started. Also, does the test name need to be TestA or TestA() line by line – Tree55Topz Jan 25 '18 at 18:57
Building off of Charlies post from above - The way I was able to set this up was using the --testlist option.
First create a testlist.txt file and store it somewhere in your solution. Structure the file in such a way so if you have a class like.
namespace NamespaceA
{
class TestGroup
{
[Test]
public void TestOne()
{
}
[Test]
public void TestTwo()
{
}
}
}
the files contents would look like this..
NamespaceA.TestGroup.TestOne
or for both..
NamespaceA.TestGroup
Then just your standard consule runner command
"nunit-console.exe" "path/to/.dll" --testlist="path/to/testlist.txt"
:D)

- 1,102
- 4
- 20
- 51