Nunit pass params to Test from nunit-console -
i using below pass single parameter test.
c:\documents , settings\>"c:\program files\nunit 2.6.2\bin\nunit-console" "d:\automation\classlibrary2\bin\debug\classlibrary2.dll /run:classlibrary2.class1.test1(\"option1\")
mycode:
namespace classlibrary2 { [testfixture] public class class1 { [test] public void test1(string browser) { messagebox.show(browse ); } } }
result: tests run: 0, errors: 0, failures: 0, inconclusive: 0, time: 0 seconds
so how pass parameters directly nunit-console test.
the way have solved problem allowing environment variables override configuration properties.
then can control environment variables build scripts, build servers, etc. control tests run in environment want them to.
for example:
[testfixture] public class dataaccesstest { static string getconnectionstring() { return environment.getenvironmentvariable("connectionstringfortest") ?? defaultconnectionstring; } [test] public void test() { var context = new datacontext(getconnectionstring()); ... } }