Browse Source

Specify /noxml in the NUnit-Console command line if xml test results are not to be generated.

pull/6/merge
Matt Ward 14 years ago
parent
commit
ddc4ba94a3
  1. 4
      src/AddIns/Analysis/CodeCoverage/Test/Testing/CodeCoverageTestRunnerTests.cs
  2. 4
      src/AddIns/Analysis/CodeCoverage/Test/Testing/PartCoverApplicationTests.cs
  3. 10
      src/AddIns/Analysis/UnitTesting/Src/NUnitConsoleApplication.cs
  4. 29
      src/AddIns/Analysis/UnitTesting/Test/Frameworks/NUnitConsoleCommandLineTests.cs
  5. 2
      src/AddIns/Analysis/UnitTesting/Test/Frameworks/NUnitConsoleProcessStartInfoTestFixture.cs
  6. 2
      src/AddIns/Analysis/UnitTesting/Test/Tree/RunNUnitTestsForMethodTestFixture.cs
  7. 4
      src/AddIns/Analysis/UnitTesting/Test/Tree/RunNUnitTestsWithDebuggerTestFixture.cs
  8. 2
      src/AddIns/Analysis/UnitTesting/Test/Tree/RunTestInPadCommandTestFixture.cs
  9. 4
      src/AddIns/Analysis/UnitTesting/Test/Tree/RunTestWithDebuggerCommandTestFixture.cs
  10. 2
      src/AddIns/Analysis/UnitTesting/UnitTesting.csproj

4
src/AddIns/Analysis/CodeCoverage/Test/Testing/CodeCoverageTestRunnerTests.cs

@ -118,7 +118,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -118,7 +118,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
string expectedCommandLine =
"--target \"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"--target-work-dir \"c:\\projects\\MyTests\\bin\\Debug\" " +
"--target-args \"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /results=\\\"d:\\temp\\results.txt\\\"\" " +
"--target-args \"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml /results=\\\"d:\\temp\\results.txt\\\"\" " +
"--output \"c:\\projects\\MyTests\\PartCover\\coverage.xml\" " +
"--include [MyTests]*";
@ -218,7 +218,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -218,7 +218,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
"\"d:\\sharpdevelop\\bin\\Tools\\PartCover\\PartCover.exe\" " +
"--target \"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"--target-work-dir \"c:\\projects\\MyTests\\bin\\Debug\" " +
"--target-args \"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\"\" " +
"--target-args \"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " +
"--output \"c:\\projects\\MyTests\\PartCover\\coverage.xml\" " +
"--include [*]*";
}

4
src/AddIns/Analysis/CodeCoverage/Test/Testing/PartCoverApplicationTests.cs

@ -133,7 +133,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -133,7 +133,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
string expectedCommandLine =
"--target \"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"--target-work-dir \"c:\\projects\\MyTests\\bin\\Debug\" " +
"--target-args \"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\"\" " +
"--target-args \"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " +
"--output \"c:\\projects\\MyTests\\PartCover\\coverage.xml\" " +
"--include [*]*";
@ -157,7 +157,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing @@ -157,7 +157,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing
string expectedCommandLine =
"--target \"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"--target-work-dir \"c:\\projects\\MyTests\\bin\\Debug\" " +
"--target-args \"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\"\" " +
"--target-args \"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " +
"--output \"c:\\projects\\MyTests\\PartCover\\coverage.xml\" " +
"--include [MyTests]* " +
"--include [MoreTests]* " +

10
src/AddIns/Analysis/UnitTesting/Src/NUnitConsoleCommandLine.cs → src/AddIns/Analysis/UnitTesting/Src/NUnitConsoleApplication.cs

@ -51,6 +51,7 @@ namespace ICSharpCode.UnitTesting @@ -51,6 +51,7 @@ namespace ICSharpCode.UnitTesting
NoDots = options.NoDots;
Labels = options.Labels;
ShadowCopy = !options.NoShadow;
NoXmlOutputFile = !options.CreateXmlOutputFile;
if (options.CreateXmlOutputFile) {
GenerateXmlOutputFileName();
@ -121,6 +122,11 @@ namespace ICSharpCode.UnitTesting @@ -121,6 +122,11 @@ namespace ICSharpCode.UnitTesting
/// </summary>
public string XmlOutputFile;
/// <summary>
/// Use /noxml.
/// </summary>
public bool NoXmlOutputFile = true;
/// <summary>
/// Fixture to test. Null = test all fixtures.
/// </summary>
@ -195,7 +201,9 @@ namespace ICSharpCode.UnitTesting @@ -195,7 +201,9 @@ namespace ICSharpCode.UnitTesting
b.Append(" /labels");
if (NoDots)
b.Append(" /nodots");
if (XmlOutputFile != null) {
if (NoXmlOutputFile) {
b.Append(" /noxml");
} else if (XmlOutputFile != null) {
b.Append(" /xml=\"");
b.Append(XmlOutputFile);
b.Append('"');

29
src/AddIns/Analysis/UnitTesting/Test/Frameworks/NUnitConsoleCommandLineTests.cs

@ -32,6 +32,7 @@ namespace UnitTesting.Tests.Frameworks @@ -32,6 +32,7 @@ namespace UnitTesting.Tests.Frameworks
NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
app.NoLogo = false;
app.ShadowCopy = true;
app.NoXmlOutputFile = false;
app.Results = @"C:\results.txt";
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /results=\"C:\\results.txt\"";
@ -45,6 +46,7 @@ namespace UnitTesting.Tests.Frameworks @@ -45,6 +46,7 @@ namespace UnitTesting.Tests.Frameworks
NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
app.NoLogo = true;
app.ShadowCopy = true;
app.NoXmlOutputFile = false;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /nologo";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
@ -57,6 +59,7 @@ namespace UnitTesting.Tests.Frameworks @@ -57,6 +59,7 @@ namespace UnitTesting.Tests.Frameworks
NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
app.NoLogo = false;
app.ShadowCopy = false;
app.NoXmlOutputFile = false;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /noshadow";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
@ -70,6 +73,7 @@ namespace UnitTesting.Tests.Frameworks @@ -70,6 +73,7 @@ namespace UnitTesting.Tests.Frameworks
app.NoLogo = false;
app.ShadowCopy = true;
app.NoThread = true;
app.NoXmlOutputFile = false;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /nothread";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
@ -83,6 +87,7 @@ namespace UnitTesting.Tests.Frameworks @@ -83,6 +87,7 @@ namespace UnitTesting.Tests.Frameworks
app.NoLogo = false;
app.ShadowCopy = true;
app.NoDots = true;
app.NoXmlOutputFile = false;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /nodots";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
@ -96,6 +101,7 @@ namespace UnitTesting.Tests.Frameworks @@ -96,6 +101,7 @@ namespace UnitTesting.Tests.Frameworks
app.NoLogo = false;
app.ShadowCopy = true;
app.Labels = true;
app.NoXmlOutputFile = false;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /labels";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
@ -109,6 +115,7 @@ namespace UnitTesting.Tests.Frameworks @@ -109,6 +115,7 @@ namespace UnitTesting.Tests.Frameworks
app.NoLogo = false;
app.ShadowCopy = true;
app.Fixture = "TestFixture";
app.NoXmlOutputFile = false;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /run=\"TestFixture\"";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
@ -122,6 +129,7 @@ namespace UnitTesting.Tests.Frameworks @@ -122,6 +129,7 @@ namespace UnitTesting.Tests.Frameworks
app.NoLogo = false;
app.ShadowCopy = true;
app.NamespaceFilter = "TestFixture";
app.NoXmlOutputFile = false;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /run=\"TestFixture\"";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
@ -135,11 +143,26 @@ namespace UnitTesting.Tests.Frameworks @@ -135,11 +143,26 @@ namespace UnitTesting.Tests.Frameworks
app.NoLogo = false;
app.ShadowCopy = true;
app.XmlOutputFile = @"C:\NUnit.xml";
app.NoXmlOutputFile = false;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /xml=\"C:\\NUnit.xml\"";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
}
[Test]
public void NoXmlWhenXmlOutputFileSpecified()
{
SelectedTests selectedTests = new SelectedTests(project);
NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
app.NoLogo = false;
app.ShadowCopy = true;
app.XmlOutputFile = @"C:\NUnit.xml";
app.NoXmlOutputFile = true;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /noxml";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
}
[Test]
public void TestMethod()
{
@ -149,6 +172,7 @@ namespace UnitTesting.Tests.Frameworks @@ -149,6 +172,7 @@ namespace UnitTesting.Tests.Frameworks
app.ShadowCopy = true;
app.Fixture = "TestFixture";
app.Test = "Test";
app.NoXmlOutputFile = false;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /run=\"TestFixture.Test\"";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
@ -163,6 +187,7 @@ namespace UnitTesting.Tests.Frameworks @@ -163,6 +187,7 @@ namespace UnitTesting.Tests.Frameworks
NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
app.NoLogo = false;
app.ShadowCopy = true;
app.NoXmlOutputFile = false;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /run=\"TestFixture.Test\"";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
@ -175,6 +200,7 @@ namespace UnitTesting.Tests.Frameworks @@ -175,6 +200,7 @@ namespace UnitTesting.Tests.Frameworks
NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
app.NoLogo = false;
app.ShadowCopy = true;
app.NoXmlOutputFile = false;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" /run=\"Project.MyTests\"";
Assert.AreEqual(expectedCommandLine, app.GetArguments());
@ -187,6 +213,7 @@ namespace UnitTesting.Tests.Frameworks @@ -187,6 +213,7 @@ namespace UnitTesting.Tests.Frameworks
NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
app.NoLogo = true;
app.ShadowCopy = true;
app.NoXmlOutputFile = false;
FileUtility.ApplicationRootPath = @"C:\SharpDevelop";
@ -211,6 +238,7 @@ namespace UnitTesting.Tests.Frameworks @@ -211,6 +238,7 @@ namespace UnitTesting.Tests.Frameworks
app.NoLogo = false;
app.ShadowCopy = true;
app.Results = @"C:\results.txt";
app.NoXmlOutputFile = false;
string expectedCommandLine =
"\"C:\\Projects\\MyTests\\MyTests.dll\" " +
@ -235,6 +263,7 @@ namespace UnitTesting.Tests.Frameworks @@ -235,6 +263,7 @@ namespace UnitTesting.Tests.Frameworks
NUnitConsoleApplication app = new NUnitConsoleApplication(selectedTests);
app.NoLogo = false;
app.ShadowCopy = true;
app.NoXmlOutputFile = false;
string expectedCommandLine = "\"C:\\Projects\\MyTests\\MyTests.dll\" " +
"/run=\"MyTests.TestFixture+InnerTest\"";

2
src/AddIns/Analysis/UnitTesting/Test/Frameworks/NUnitConsoleProcessStartInfoTestFixture.cs

@ -50,7 +50,7 @@ namespace UnitTesting.Tests.Frameworks @@ -50,7 +50,7 @@ namespace UnitTesting.Tests.Frameworks
public void CommandLineArgumentsAreNUnitConsoleExeCommandLineArguments()
{
string expectedCommandLine =
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\"";
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\" /noxml";
Assert.AreEqual(expectedCommandLine, info.Arguments);
}

2
src/AddIns/Analysis/UnitTesting/Test/Tree/RunNUnitTestsForMethodTestFixture.cs

@ -173,7 +173,7 @@ namespace UnitTesting.Tests.Tree @@ -173,7 +173,7 @@ namespace UnitTesting.Tests.Tree
StartNUnitTestRunner();
string expectedArgs =
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\" " +
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\" /noxml " +
"/results=\"c:\\temp\\tmp66.tmp\" " +
"/run=\"MyTests.MyTestClass.MyTestMethod\"";
Assert.AreEqual(expectedArgs, context.MockProcessRunner.CommandArgumentsPassedToStartMethod);

4
src/AddIns/Analysis/UnitTesting/Test/Tree/RunNUnitTestsWithDebuggerTestFixture.cs

@ -57,7 +57,7 @@ namespace UnitTesting.Tests.Tree @@ -57,7 +57,7 @@ namespace UnitTesting.Tests.Tree
StartTestDebugger();
string expectedArguments =
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\" " +
"/noshadow " +
"/noshadow /noxml " +
"/results=\"c:\\temp\\tmp66.tmp\" " +
"/run=\"MyTests.MyTestClass.MyTestMethod\"";
@ -167,7 +167,7 @@ namespace UnitTesting.Tests.Tree @@ -167,7 +167,7 @@ namespace UnitTesting.Tests.Tree
string commandLine = "\"C:\\SharpDevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\" " +
"/noshadow " +
"/noshadow /noxml " +
"/results=\"c:\\temp\\tmp66.tmp\" " +
"/run=\"MyTests.MyTestClass.MyTestMethod\"";
Assert.AreEqual(commandLine, message);

2
src/AddIns/Analysis/UnitTesting/Test/Tree/RunTestInPadCommandTestFixture.cs

@ -79,7 +79,7 @@ namespace UnitTesting.Tests.Tree @@ -79,7 +79,7 @@ namespace UnitTesting.Tests.Tree
{
runCommand.Run();
buildProject.FireBuildCompleteEvent();
string expectedArgs = "\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\"";
string expectedArgs = "\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\" /noxml";
Assert.AreEqual(expectedArgs, processRunner.CommandArgumentsPassedToStartMethod);
}

4
src/AddIns/Analysis/UnitTesting/Test/Tree/RunTestWithDebuggerCommandTestFixture.cs

@ -34,7 +34,7 @@ namespace UnitTesting.Tests.Tree @@ -34,7 +34,7 @@ namespace UnitTesting.Tests.Tree
public void DebuggerStartsUnitTestApplicationWithCorrectCommandLineArguments()
{
string expectedArguments =
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\"";
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\" /noxml";
string actualArguments = debuggerService.MockDebugger.ProcessStartInfo.Arguments;
Assert.AreEqual(expectedArguments, actualArguments);
@ -54,7 +54,7 @@ namespace UnitTesting.Tests.Tree @@ -54,7 +54,7 @@ namespace UnitTesting.Tests.Tree
{
string expectedText =
"\"D:\\SharpDevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " +
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\"\r\n";
"\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\" /noxml\r\n";
string actualText = context.UnitTestCategory.Text;
Assert.AreEqual(expectedText, actualText);

2
src/AddIns/Analysis/UnitTesting/UnitTesting.csproj

@ -126,7 +126,7 @@ @@ -126,7 +126,7 @@
<Compile Include="Src\TestTreeView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Src\NUnitConsoleCommandLine.cs" />
<Compile Include="Src\NUnitConsoleApplication.cs" />
<Compile Include="Src\AbstractRunTestCommand.cs" />
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="..\..\..\Main\GlobalAssemblyInfo.cs">

Loading…
Cancel
Save