Cannot run nunit project through dot net

"GULAB TEJWANI" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <[email protected]>
Hello All,
I am facing a strange problem. When i run the nunit project through
nunit-console, it runs properly. However when i do it programatically
through dot net's process class i get follwoing exception.


-------------------------------------------------------------------------------------------------------------------------------------

Unhandled Exception:

System.NullReferenceException: Object reference not set to an instance of an
object.

Server stack trace:

at NUnit.Core.SimpleTestRunner.CountTestCases(ITestFilter filter)

at NUnit.Core.DelegatingTestRunner.CountTestCases(ITestFilter filter)

at NUnit.Core.DelegatingTestRunner.CountTestCases(ITestFilter filter)

at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)

at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)

at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage
msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:

at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)

at NUnit.Core.TestRunner.CountTestCases(ITestFilter filter)

at NUnit.Util.ProxyTestRunner.CountTestCases(ITestFilter filter)

at NUnit.Util.AggregatingTestRunner.CountTestCases(ITestFilter filter)

at NUnit.Util.AggregatingTestRunner.Run(EventListener listener, ITestFilter
filter)

at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)

at NUnit.ConsoleRunner.Runner.Main(String[] args)

---------------------------------------------------------------------------------------------------------------------------------

Following is the code i have written to execute it:

public static string Execute(string fileName, string args)

{

string outputText = String.Empty;

try

{

Process process = new Process();

if (!(args == null || args.Trim() == String.Empty))

process.StartInfo.Arguments = args;

process.StartInfo.FileName = fileName;

process.StartInfo.UseShellExecute = false;

process.StartInfo.WorkingDirectory = @"C:\Documents and
Settings\GulabTejwani";

process.StartInfo.RedirectStandardOutput = true;

process.Start();

outputText = process.StandardOutput.ReadToEnd();

process.WaitForExit();

process.Close();

}

catch (Exception ex)

{

Logger.Add(DateTime.Now.ToString() + " Cannot execute " + fileName + ". " +
ex.Message);

}

return outputText;

}

Parameters i pass to this method are :

1) Filename: C:\Program Files\NUnit 2.4.3\bin\nunit-console.exe

2) Args to nunitconsole.exe : C:\Program
Files\SunGard\AdaptivOperations\Bin\UnitTest.nunit /nodots /nologo



Can somebody tell me what the issue is?

Thanks,

Gulab.

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php

_______________________________________________
Nunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nunit-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.