1

I would like to create a test suite using NUnit.

In java, I could use the name of the classes and do something like this:

TestSuite suite = new TestSuite();
suite.addTest(new JUnit4TestAdapter(Class.forName({Name of my test class here})));

In NUnit, I have a TestSuite created (from NUnit.Core) but I can't create Tests dynamically and add them to the suite.

I appreciate the help, thanks.

1

In NUnit 2.4.4, there is a new feature - the Suite Attribute that allows you to return an array of tests as opposed to using the TestSuite class in previous versions. To add tests, it would look something like this:

[Suite] 
public static IEnumerable Suite
{
   get
   {
      ArrayList suite = new ArrayList();
      suite.Add(new AddAll());
      return suite;
   }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.