0

I have 2.5.8 and VS2010

I want to run tests against a dll and if I type

nunit-console a.dll

I also have these suites

public class AllTests
{
    [Suite]
    public static IEnumerable Suite
    {
        get
        {
            List<Type> suite = new List<Type>();
            foreach (Type testCase in UnitTests.Suite)
            {
                suite.Add(testCase);
            }
            return suite;
        }
    }
}

and

public class UnitTests
{
    [Suite]
    public static IEnumerable Suite
    {
        get
        {
            List<Type> suite = new List<Type>();
            suite.Add(typeof(LicenceManagerTests));
            suite.Add(typeof(CertManagerTests));
            return suite;
        }
    }
}

If I would like to run tests using Suites I type

nunit-console a.dll /fixture=AllTests.Suite

but it fails with the message

Unable to locate fixture AllTests.Suite

If you wonder why I use Suites ,I don't know. We are using MSBuild in our project and this is a requirement of MSBuild I guess.

Any help appreciated. Regards.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
tguclu
  • 689
  • 3
  • 10
  • 25

2 Answers2

1

Precede your class with the following tag [TestFixture]

I think that is what is missing,

While I have not used suites. But my normal unit tests resemble something like this

[TestFixture]
public class A
{
//Properties
[Setup]
public void Setup()
{
//Setup code before each test, usually to set any constants, properties defined above
}
[Test]
public void TestA()
{
//test code
Asset.IsTrue(<func()>);
}

} 

and run the test as nunit-console nunit.tests.dll [whatever is the dll generated]

Tell me if that helps

Baz1nga
  • 15,485
  • 3
  • 35
  • 61
  • hi. actuallyI did not ask about this. This is how we call and run tests. My questions is about using Suites. AFAIK suites are used to group tests. They are not used much nowadays instead Category is used. – tguclu Dec 24 '10 at 15:22
  • ah sorry! nt much exp with suites – Baz1nga Dec 25 '10 at 21:26
0

I found the solution.

The trick is namespace. Namespace of alltests and unittests classes should be

"Suites".

Otherwise I keep receving "unable to locate".. Regards

tguclu
  • 689
  • 3
  • 10
  • 25