nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #01575
[Bug 731994] [NEW] Cannot run individual testscases with more than one parameter in nunit-console
Public bug reported:
I can run an individual testcase which takes a single string value with
no problems from the command line:
For example /run:Namespace.Class.Method("my input string")
However the same procedure doesn't seem to work for me with numerical
inputs
For example: /run:Namespace.Class.Method(1,2,3)
The output lists the correct input as a 'test to run' but does not
actually run any tests
Looking into this further, it appears that the problem is with tests
which take more than one argument. Using the following test file:
namespace GetTestsProj { [TestFixture] class NunitConsoleTest
{ [TestCase(1,2,3)] [Test, Description("A simple test
with parameterized numeric inputs")] public void TestNumeric(int
a, int b, int c) { Assert.AreEqual(c, a + b);
} [TestCase("My String")] [Test, Description("A simple
test with parameterized string input")] public void
TestSingleString(string a) { Assert.AreEqual("My
String", a); } [TestCase("String1", "String2")]
[Test, Description("A simple test with parameterized numeric inputs")]
public void TestTwoStrings(string a, string b) {
Assert.AreEqual("String1", a); } } } The call nunit-
console.exe /run:GetTestsProj.NunitConsoleTest
GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll properly runs all 3
testcases
The call nunit-console.exe
/run:GetTestsProj.NunitConsoleTest.TestNumeric
GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll properly runs 1
testcase
The call nunit-console.exe
/run:"GetTestsProj.NunitConsoleTest.TestSingleString(\"My String\")"
GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll properly runs 1
testcase
However, the call nunit-console.exe
/run:GetTestsProj.NunitConsoleTest.TestNumeric(1,2,3)
GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll runs 0 testcases
And similarly the call nunit-console.exe
/run:"GetTestsProj.NunitConsoleTest.TestTwoStrings(\"String1\",\"String2\")"
GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll runs 0 testcases
Although nunit seems to recognize the input /run properly:
Selected test(s): GetTestsProj.NunitConsoleTest.TestNumeric(1,2,3)
Tests run: 0, Errors: 0, Failures: 0, Inconclusive: 0, Time: 0 seconds
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0 and
Selected test(s):
GetTestsProj.NunitConsoleTest.TestTwoStrings("String1", "String2")
Tests run: 0, Errors: 0, Failures: 0, Inconclusive: 0, Time: 0.0156256
seconds Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0 This is all
using NUnit 2.5.9.10348
I've tried digging around the nUnit code but see no obvious answer of
what is wrong (I am in fact using
TypeHelper.GetDisplayName(m.GetType(), args); to generate the parameter
string, which I would expect to be consistent with internal usage).
** Affects: nunit-3.0
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of NUnit
Core Developers, which is the registrant for NUnit Framework.
https://bugs.launchpad.net/bugs/731994
Title:
Cannot run individual testscases with more than one parameter in
nunit-console
Status in NUnit Test Framework:
New
Bug description:
I can run an individual testcase which takes a single string value
with no problems from the command line:
For example /run:Namespace.Class.Method("my input string")
However the same procedure doesn't seem to work for me with numerical
inputs
For example: /run:Namespace.Class.Method(1,2,3)
The output lists the correct input as a 'test to run' but does not
actually run any tests
Looking into this further, it appears that the problem is with tests
which take more than one argument. Using the following test file:
namespace GetTestsProj { [TestFixture] class NunitConsoleTest
{ [TestCase(1,2,3)] [Test, Description("A simple test
with parameterized numeric inputs")] public void
TestNumeric(int a, int b, int c) {
Assert.AreEqual(c, a + b); } [TestCase("My String")]
[Test, Description("A simple test with parameterized string input")]
public void TestSingleString(string a) {
Assert.AreEqual("My String", a); }
[TestCase("String1", "String2")] [Test, Description("A simple
test with parameterized numeric inputs")] public void
TestTwoStrings(string a, string b) {
Assert.AreEqual("String1", a); } } } The call nunit-
console.exe /run:GetTestsProj.NunitConsoleTest
GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll properly runs all
3 testcases
The call nunit-console.exe
/run:GetTestsProj.NunitConsoleTest.TestNumeric
GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll properly runs 1
testcase
The call nunit-console.exe
/run:"GetTestsProj.NunitConsoleTest.TestSingleString(\"My String\")"
GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll properly runs 1
testcase
However, the call nunit-console.exe
/run:GetTestsProj.NunitConsoleTest.TestNumeric(1,2,3)
GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll runs 0 testcases
And similarly the call nunit-console.exe
/run:"GetTestsProj.NunitConsoleTest.TestTwoStrings(\"String1\",\"String2\")"
GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll runs 0 testcases
Although nunit seems to recognize the input /run properly:
Selected test(s): GetTestsProj.NunitConsoleTest.TestNumeric(1,2,3)
Tests run: 0, Errors: 0, Failures: 0, Inconclusive: 0, Time: 0 seconds
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0 and
Selected test(s):
GetTestsProj.NunitConsoleTest.TestTwoStrings("String1", "String2")
Tests run: 0, Errors: 0, Failures: 0, Inconclusive: 0, Time: 0.0156256
seconds Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0 This is all
using NUnit 2.5.9.10348
I've tried digging around the nUnit code but see no obvious answer of
what is wrong (I am in fact using
TypeHelper.GetDisplayName(m.GetType(), args); to generate the
parameter string, which I would expect to be consistent with internal
usage).
Follow ups
References