With xUnit, all you need is to implement ITestRunner interface, i.e. : public class MyTestRunner : ITestRunner { // Methods public MyTestRunner(); public static TestRunState RunAssembly(TestRunner runner); public static TestRunState RunClass(TestRunner runner, Type type); public static TestRunState RunClassWithInnerTypes(TestRunner runner, Type type); public static TestRunState RunMethod(TestRunner runner, MethodInfo method); TestRunState ITestRunner. RunAssembly(ITestListener listener, Assembly assembly); TestRunState ITestRunner.
RunMember(ITestListener listener, Assembly assembly, MemberInfo member); TestRunState ITestRunner. RunNamespace(ITestListener listener, Assembly assembly, string ns); } For implementation details, grab the source code of xUnit and have a look at the sample runners.
Not what I was looking for. – Emil C Jul 8 at 22:00 Why is that? If really so, how did you solve the problem?
– Teoman Soygul Jul 9 at 7:29.
If you mean how can you run NUnit tests programmatically (instead of using one of the supplied NUnit runners), then it's actually pretty easy: using System; using NUnit. Core; using NUnit. Framework; using MyProject.
Tests; /* assuming MyTestFixture is defined in this project/assembly */ namespace TestRunner. DemoApp { class Program { static void Main(string args) { var builder = new TestSuiteBuilder(); var testAssemblyLocation = typeof(MyTestFixture).Assembly. Location; var package = new TestPackage(testAssemblyLocation); var suite = builder.
Build(package); Console. ForegroundColor = ConsoleColor. White; Console.
WriteLine("Running tests from " + testAssemblyLocation; Console. WriteLine("Testing against " + ConfigurationManager. AppSettings"HostNameSuffix"); var result = suite.
Run(new NullListener(), TestFilter. Empty); switch (result. ResultState) { case ResultState.
Success: Console. ForegroundColor = ConsoleColor. Green; Console.
WriteLine("Pass. "); break; case ResultState. Error: case ResultState.
Failure: Console. ForegroundColor = ConsoleColor. Red; DrawResults(result.
Results, r => r. ResultState == ResultState. Error || r.
ResultState == ResultState. Failure); break; } static void DrawResults(IList results, Func include) { foreach (var obj in results) { var result = obj as TestResult; if (result == null) continue; if (result. Results!
= null && result.Results. Count > 0) { DrawResults(result. Results, include); } else if (include(result)) { Console.
WriteLine(result. Name); Console. WriteLine(result.
Message); Console. WriteLine(result. ResultState); Console.
WriteLine(result. StackTrace); Console. WriteLine(String.Empty.
PadLeft(Console. WindowWidth, '=')); } } } } }.
Not really what I was looking for. I don't need to build a test runner. I need to run test in nunits test runner.
– Emil C Jun 12 at 6:19.
You can use the TestCaseSourceAttribute in NUnit to run dynamic tests.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.