Click here to Skip to main content
15,893,588 members
Articles / Programming Languages / C#

Setup a Test Project with NUnit and MonoDevelop

Rate me:
Please Sign up or sign in to vote.
4.20/5 (3 votes)
24 Mar 2009CPOL3 min read 74.4K   373   14  
How to set up an NUnit test project within MonoDevelop
<?xml version="1.0" encoding="utf-8"?>
<TestRecord xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Results>
    <UnitTestResult>
      <TestDate>2009-03-22T10:54:18-07:00</TestDate>
      <Status>Success</Status>
      <TotalFailures>0</TotalFailures>
      <TotalSuccess>1</TotalSuccess>
      <TotalIgnored>0</TotalIgnored>
      <Time />
    </UnitTestResult>
    <UnitTestResult>
      <TestDate>2009-03-22T11:00:50-07:00</TestDate>
      <Status>Failure</Status>
      <TotalFailures>1</TotalFailures>
      <TotalSuccess>0</TotalSuccess>
      <TotalIgnored>0</TotalIgnored>
      <Time />
    </UnitTestResult>
    <UnitTestResult>
      <TestDate>2009-03-22T11:02:23-07:00</TestDate>
      <Status>Failure</Status>
      <TotalFailures>1</TotalFailures>
      <TotalSuccess>0</TotalSuccess>
      <TotalIgnored>0</TotalIgnored>
      <Time />
    </UnitTestResult>
    <UnitTestResult>
      <TestDate>2009-03-22T11:08:24</TestDate>
      <Status>Failure</Status>
      <TotalFailures>1</TotalFailures>
      <TotalSuccess>0</TotalSuccess>
      <TotalIgnored>0</TotalIgnored>
      <Time />
    </UnitTestResult>
  </Results>
  <Tests>
    <TestRecord Name="MyLibraryTest">
      <Results>
        <UnitTestResult>
          <TestDate>2009-03-22T10:54:18-07:00</TestDate>
          <Status>Success</Status>
          <TotalFailures>0</TotalFailures>
          <TotalSuccess>1</TotalSuccess>
          <TotalIgnored>0</TotalIgnored>
          <Time />
        </UnitTestResult>
        <UnitTestResult>
          <TestDate>2009-03-22T11:00:50-07:00</TestDate>
          <Status>Failure</Status>
          <TotalFailures>1</TotalFailures>
          <TotalSuccess>0</TotalSuccess>
          <TotalIgnored>0</TotalIgnored>
          <Time />
        </UnitTestResult>
        <UnitTestResult>
          <TestDate>2009-03-22T11:02:23-07:00</TestDate>
          <Status>Failure</Status>
          <TotalFailures>1</TotalFailures>
          <TotalSuccess>0</TotalSuccess>
          <TotalIgnored>0</TotalIgnored>
          <Time />
        </UnitTestResult>
        <UnitTestResult>
          <TestDate>2009-03-22T11:08:24</TestDate>
          <Status>Failure</Status>
          <TotalFailures>1</TotalFailures>
          <TotalSuccess>0</TotalSuccess>
          <TotalIgnored>0</TotalIgnored>
          <Time />
        </UnitTestResult>
      </Results>
      <Tests>
        <TestRecord Name="MyClassTest">
          <Results>
            <UnitTestResult>
              <TestDate>2009-03-22T10:54:18-07:00</TestDate>
              <Status>Success</Status>
              <TotalFailures>0</TotalFailures>
              <TotalSuccess>1</TotalSuccess>
              <TotalIgnored>0</TotalIgnored>
              <Time />
            </UnitTestResult>
            <UnitTestResult>
              <TestDate>2009-03-22T11:00:50-07:00</TestDate>
              <Status>Failure</Status>
              <TotalFailures>1</TotalFailures>
              <TotalSuccess>0</TotalSuccess>
              <TotalIgnored>0</TotalIgnored>
              <Time />
            </UnitTestResult>
            <UnitTestResult>
              <TestDate>2009-03-22T11:02:23-07:00</TestDate>
              <Status>Failure</Status>
              <TotalFailures>1</TotalFailures>
              <TotalSuccess>0</TotalSuccess>
              <TotalIgnored>0</TotalIgnored>
              <Time />
            </UnitTestResult>
            <UnitTestResult>
              <TestDate>2009-03-22T11:08:24</TestDate>
              <Status>Failure</Status>
              <TotalFailures>1</TotalFailures>
              <TotalSuccess>0</TotalSuccess>
              <TotalIgnored>0</TotalIgnored>
              <Time />
            </UnitTestResult>
          </Results>
          <Tests>
            <TestRecord Name="DivideTest">
              <Results>
                <UnitTestResult>
                  <TestDate>2009-03-22T17:35:27-07:00</TestDate>
                  <Status>Failure</Status>
                  <TotalFailures>1</TotalFailures>
                  <TotalSuccess>0</TotalSuccess>
                  <TotalIgnored>0</TotalIgnored>
                  <Time />
                  <Message />
                  <StackTrace>  at NUnit.Framework.Assert.DoAssert (IAsserter asserter) [0x00000] 
  at NUnit.Framework.Assert.IsNaN (Double aDouble, System.String message, System.Object[] args) [0x00000] 
  at NUnit.Framework.Assert.IsNaN (Double aDouble) [0x00000] 
  at MyLibraryTest.MyClassTest.DivideTest () [0x00000] 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] </StackTrace>
                  <ConsoleOutput />
                  <ConsoleError />
                </UnitTestResult>
                <UnitTestResult>
                  <TestDate>2009-03-22T10:54:18-07:00</TestDate>
                  <Status>Success</Status>
                  <TotalFailures>0</TotalFailures>
                  <TotalSuccess>1</TotalSuccess>
                  <TotalIgnored>0</TotalIgnored>
                  <Time />
                  <ConsoleOutput />
                  <ConsoleError />
                </UnitTestResult>
                <UnitTestResult>
                  <TestDate>2009-03-22T11:00:50-07:00</TestDate>
                  <Status>Failure</Status>
                  <TotalFailures>1</TotalFailures>
                  <TotalSuccess>0</TotalSuccess>
                  <TotalIgnored>0</TotalIgnored>
                  <Time />
                  <Message>
	expected: &lt;-1&gt;
	 but was: &lt;0&gt;</Message>
                  <StackTrace>  at NUnit.Framework.Assert.DoAssert (IAsserter asserter) [0x00000] 
  at NUnit.Framework.Assert.AreEqual (Int32 expected, Int32 actual, System.String message, System.Object[] args) [0x00000] 
  at NUnit.Framework.Assert.AreEqual (Int32 expected, Int32 actual) [0x00000] 
  at MyLibraryTest.MyClassTest.DivideTest () [0x00000] 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] </StackTrace>
                  <ConsoleOutput />
                  <ConsoleError />
                </UnitTestResult>
                <UnitTestResult>
                  <TestDate>2009-03-22T11:02:23-07:00</TestDate>
                  <Status>Failure</Status>
                  <TotalFailures>1</TotalFailures>
                  <TotalSuccess>0</TotalSuccess>
                  <TotalIgnored>0</TotalIgnored>
                  <Time />
                  <Message>
	expected: &lt;-1&gt;
	 but was: &lt;0&gt;</Message>
                  <StackTrace>  at NUnit.Framework.Assert.DoAssert (IAsserter asserter) [0x00000] 
  at NUnit.Framework.Assert.AreEqual (Int32 expected, Int32 actual, System.String message, System.Object[] args) [0x00000] 
  at NUnit.Framework.Assert.AreEqual (Int32 expected, Int32 actual) [0x00000] 
  at MyLibraryTest.MyClassTest.DivideTest () [0x00000] 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] </StackTrace>
                  <ConsoleOutput />
                  <ConsoleError />
                </UnitTestResult>
                <UnitTestResult>
                  <TestDate>2009-03-22T11:08:24</TestDate>
                  <Status>Failure</Status>
                  <TotalFailures>1</TotalFailures>
                  <TotalSuccess>0</TotalSuccess>
                  <TotalIgnored>0</TotalIgnored>
                  <Time />
                  <Message>
	expected: &lt;-1&gt;
	 but was: &lt;0&gt;</Message>
                  <StackTrace>  at NUnit.Framework.Assert.DoAssert (IAsserter asserter) [0x00000] 
  at NUnit.Framework.Assert.AreEqual (Int32 expected, Int32 actual, System.String message, System.Object[] args) [0x00000] 
  at NUnit.Framework.Assert.AreEqual (Int32 expected, Int32 actual) [0x00000] 
  at MyLibraryTest.MyClassTest.DivideTest () [0x00000] 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] </StackTrace>
                  <ConsoleOutput />
                  <ConsoleError />
                </UnitTestResult>
              </Results>
              <Tests />
            </TestRecord>
          </Tests>
        </TestRecord>
      </Tests>
    </TestRecord>
  </Tests>
</TestRecord>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
C# Rules!

Comments and Discussions