1

I have a NUnit visual studio test project class library type ,I need to pass command line argument in to project and access that argument.

When i have create another class library type project then i am able to take argument into Main function.

But the Nunit test project have not entry point or Main function.How to do that scenario.

Please help.

Neeraj Dubey
  • 4,401
  • 8
  • 30
  • 49
  • 1
    You sure you want to do this? It probably falls prey to taking a dependency on something external. However, take a look at [Environment.GetCommandLineArgs](http://msdn.microsoft.com/en-us/library/system.environment.getcommandlineargs(v=vs.110).aspx) – Lasse V. Karlsen Nov 05 '14 at 10:56
  • see this http://stackoverflow.com/questions/3189149/pass-parameters-via-command-line-to-nunit – NeddySpaghetti Nov 05 '14 at 10:59
  • @LasseV.Karlsen : it gives the following `{string[3]} [0]: "C:\\PROGRAM FILES (X86)\\MICROSOFT VISUAL STUDIO 12.0\\COMMON7\\IDE\\COMMONEXTENSIONS\\MICROSOFT\\TESTWINDOW\\vstest.executionengine.x86.exe" [1]: "/parentProcessId" [2]: "7788"` . But I have defined only `AA` in command line argument. – Neeraj Dubey Nov 05 '14 at 11:03
  • Command line arguments aren't passed from Visual Studio to the test runner, they will only work if you start the test runner manually. My advice, find a different way to do whatever it is you want done. – Lasse V. Karlsen Nov 05 '14 at 11:06
  • Please suggest the other way. I am executing the test dll from nunit command exe and need some config value pass into test project and use. – Neeraj Dubey Nov 05 '14 at 11:11

0 Answers0