posso eseguire un testcase individuo che prende un singolo valore di stringa senza problemi dalla riga di comando:Run testcase parametrizzato individuo con NUnit-console
Per esempio /run:Namespace.Class.Method("my input string")
Tuttavia la stessa procedura non sembra a lavorare per me con ingressi numerici
ad esempio: /run:Namespace.Class.Method(1,2,3)
l'output elenca l'ingresso corretto come 'prova per eseguire' ma in realtà non eseguire alcun test
EDIT:
Guardando in questo ulteriore, sembra che il problema sia con i test che prendono più di un argomento. Utilizzando il seguente file di prova:
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);
}
}
}
La chiamata nunit-console.exe /run:GetTestsProj.NunitConsoleTest GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll
gestisce correttamente tutti e 3 i casi di test
La chiamata nunit-console.exe /run:GetTestsProj.NunitConsoleTest.TestNumeric GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll
funziona correttamente 1 testcase
La chiamata nunit-console.exe /run:"GetTestsProj.NunitConsoleTest.TestSingleString(\"My String\")" GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll
eseguito correttamente 1 testcase
Tuttavia, il chiama nunit-console.exe /run:GetTestsProj.NunitConsoleTest.TestNumeric(1,2,3) GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll
esegue 0 testicoli
E allo stesso modo la chiamata nunit-console.exe /run:"GetTestsProj.NunitConsoleTest.TestTwoStrings(\"String1\",\"String2\")" GetTestsProj\GetTestsProj\bin\debug\GetTestsProj.dll
Runs 0 testcases
Anche se NUnit sembra di riconoscere l'ingresso /run
correttamente:
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
e
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
questo è tutto utilizzando NUnit 2.5.9.10348
Mi interessa sapere se si tratta di un errore dell'utente o di una funzionalità non supportata. Sarebbe molto utile per quello che sto cercando di fare.
Poiché questo è presumibilmente un bug, l'ho inviato a nunit qui: [link] (https: //bugs.launchpad.net/nunit-3.0/+ bug/731994). – afranz409