Re: Passing parameters to NUnit

"Charlie Poole" <[email protected]> Tue, 29 Jul 2008 16:41:12 -0700
Newsgroups gmane.comp.windows.dotnet.nunit.devel
Message-ID <000001c8f1d4$974966f0$6401a8c0@ferrari>
Nice idea. I'll experiment with that on both platforms.

Charlie

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On 
> Behalf Of Jeff Brown
> Sent: Tuesday, July 29, 2008 2:53 PM
> To: 'Charlie Poole'; [email protected]
> Subject: Re: [nunit-developer] Passing parameters to NUnit
> 
> A better convention is the one to precede the list of 
> arguments to be passed along straight with --.
> 
> eg.  MyWrapperApp.exe -somearg -someother arg MyProgram.exe 
> -- -argformyprogram foo bar
> 
> What's nice is that it nests trivially.
> 
> The Windows CMD does something similar with the /C and /K 
> arguments.  All following text is interpreted as the command.
> 
> Jeff.
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On 
> Behalf Of Charlie Poole
> Sent: Tuesday, July 29, 2008 10:10 AM
> To: [email protected]
> Subject: Re: [nunit-developer] Passing parameters to NUnit
> 
> So there are really two things to decide...
> 1) How to pass the parameters into NUnit
> 2) How the tests can access them
> 
> 1) The double slash convention is nice, although not directly 
> translatable into the Linux environment. I wonder if there is 
> a similar convention that they use. Maybe we could have a 
> longer, cross-platform approach like /test-args= as the last 
> option on the command line but still support the // shortcut 
> on Windows.
> 
> 2) Using Environment.CommandLineArguments is a bit 
> problematic, since we don't execute your tests as an exe. The 
> commandline args would be those for nunit, nunit-console, 
> nunit-agent, visual studio, or whatever environment you were under.
> I think we need to provide something separate like 
> TestContext.TestArguments for this to work.
> 
> Charlie
> 
> > -----Original Message-----
> > From: Sujin Han [mailto:[email protected]]
> > Sent: Tuesday, July 29, 2008 9:13 AM
> > To: [email protected]; Charlie Poole
> > Subject: RE: [nunit-developer] Passing parameters to NUnit
> > 
> > I like the convention that NCover uses - a double slash to specify 
> > NCover command line parameters, and a single slash to specify any 
> > command line parameters that you like to pass to a module it's 
> > loading.
> > 
> > Alternatively, we can have NUnit to ignore any double slash command 
> > line parameters. This way, it's fully backward compatible, 
> and people 
> > don't have to change the current usage.
> > 
> > For example, to start a test:
> >   nunit-console NUnitDemo.dll /run=STR /err=STR //myparameter:abc
> > 
> > And then, from the test code I can do this:
> > 
> > [TestFixtureSetUp]
> > public void setup(){
> >   string[] args = Environment.GetCommandLineArgs();
> >   foreach (string arg in args)
> >   {
> >     // process my command line arguments
> >     if (arg.Contains("//"))
> >       // do something
> >   }
> > }
> > 
> > Thanks
> > 
> > 
> > --- On Thu, 7/24/08, Charlie Poole 
> <[email protected]> wrote:
> > 
> > > From: Charlie Poole <[email protected]>
> > > Subject: RE: [nunit-developer] Passing parameters to NUnit
> > > To: [email protected], [email protected]
> > > Date: Thursday, July 24, 2008, 10:14 AM At the moment,
> > there is no way
> > > to pass such parameters to NUnit, nor any way for the test
> > to retrieve
> > > them if they were passed.
> > > 
> > > I'm thinking about something like this for a coming 
> release, so any 
> > > suggestions as to how it ought to work are welcome.
> > > 
> > > Charlie
> > > 
> > > > -----Original Message-----
> > > > From: [email protected]
> > > > [mailto:[email protected]]
> > > On
> > > > Behalf Of Sujin Han
> > > > Sent: Thursday, July 24, 2008 7:33 AM
> > > > To: [email protected]
> > > > Subject: [nunit-developer] Passing parameters to NUnit
> > > > 
> > > > Hi
> > > > 
> > > > I'm looking for a way to pass parameters into an
> > > NUnit test
> > > > at start-up time. I thought about faking it by setting
> > > the
> > > > environmental variables to get parameters into a test
> > > case. 
> > > > But before exploring that route I wanted to see if
> > > there were
> > > > any other options that's already there. And
> > > I'm willing to
> > > > try beta version of Nunit if necessary.
> > > > 
> > > > Thanks
> > > > 
> > > > 
> > > > 
> > > >       
> > > > 
> > > >
> > > --------------------------------------------------------------
> > > > -----------
> > > > This SF.Net email is sponsored by the Moblin Your Move
> > > 
> > > > Developer's challenge Build the coolest Linux
> > > based
> > > > applications with Moblin SDK & win great prizes
> > > Grand prize
> > > > is a trip for two to an Open Source event anywhere in
> > > the
> > > > world
> > > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> > > > _______________________________________________
> > > > nunit-developer mailing list
> > > > [email protected]
> > > >
> > > https://lists.sourceforge.net/lists/listinfo/nunit-developer
> > > >
> > 
> > 
> >       
> > 
> 
> 
> 
> --------------------------------------------------------------
> -----------
> This SF.Net email is sponsored by the Moblin Your Move 
> Developer's challenge Build the coolest Linux based 
> applications with Moblin SDK & win great prizes Grand prize 
> is a trip for two to an Open Source event anywhere in the 
> world http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> nunit-developer mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/nunit-developer
> 
> 
> --------------------------------------------------------------
> -----------
> This SF.Net email is sponsored by the Moblin Your Move 
> Developer's challenge Build the coolest Linux based 
> applications with Moblin SDK & win great prizes Grand prize 
> is a trip for two to an Open Source event anywhere in the 
> world http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> nunit-developer mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/nunit-developer
> 



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/