I have a problem with executing test from nunit3-console. I need to pass parameters to TestFixture constructor, but i want to call an specific Test. In my fixture i have two different constructors and one method without arguments. Now i call this cdm:
- nunit3-console --params username=u1;password=p1 --test namespace.class.Test1 Tests.dll
I think, now nunit try to pass this 2 parameters to my test, but i want to pass it into constructor, which have
- [TestFixtureSource(typeof(TestFixtureSource), "GetParameters")]
When i call an cmd with --where "class='TestFixtureClassName'"clause parameters are passed into testfixture constructor, but it runs all tests inside this fixture.
In example
namespace TestNamespace
{
[TestFixtureSource("GetTestFixtureSource")]
public class TestFixture
{
private int _a;
private int _b;
TestFixture()
{
_a = 8;
_b = 10;
}
TestFixture(int a, int b)
{
_a = a;
_b = b;
}
[Test]
public void Test()
{
//test1 body
}
[Test]
public void Test2()
{
//test2 body
}
[Test]
public void Test3()
{
//test3 body
}
}
}
Now in command prompt i call this line:
- nunit3-console --params a=80;b=100 --test TestNamespace.TestFixture.Test Tests.dll
Result of this line is that selenium tries to find method Test with 2 arguments. But when u call nunit-console like this:
- nunit3-console --params a=80;b=100 --where class='TestFixture' Tests.dll
It finds suitable constructor with 2 arguments and call it, but runs all Tests inside this Fixture. Now, what i want to achieve is run single test, but pass --params to suitable constructor of TestFixture.
Hope now i presented it more clearly for you.