nunit-console won't run any tests

weberc2

I'm test-driving the .Net ecosystem via Mono, but I've run into a problem with NUnit. I have the following example test file:

using NUnit.Framework;

namespace Tests
{
    [TestFixture]
    class Tests
    {
        [Test]
        public void FailingTest()
        {
            Assert.Fail("A message");
        }

        [Test]
        public void PassingTest()
        {
        }
    }
}

Which I'm building and running via:

cweber@mbp ~/temp/monoexample$ dmcs tests.cs -target:library -r:$NUNIT_FRAMEWORK_DLL
cweber@mbp ~/temp/monoexample$ ls tests.dll
tests.dll
cweber@mbp ~/temp/monoexample$ nunit-console tests.dll
NUnit version 2.4.8
Copyright (C) 2002-2007 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
   OS Version: Unix 14.5.0.0
  CLR Version: 4.0.30319.17020 ( 4.2.1 (explicit/6dd2d0d Fri Nov  6 12:25:19 EST 2015) )

.N.N
Tests run: 0, Failures: 0, Not run: 2, Time: 0.014 seconds

As you can see, neither of the tests are running.

I've Googled everything I can think of, and I've done all of the experimenting I can think of (e.g., removing the namespace, messing with fixture and run flags, etc). I've clearly simplified this example as much as I know how, but I've run out of ideas. Please let me know if I can provide any more information!

I'm sorry to ask this question if the answer ends up being obvious.

SushiHangover

Look in your TestResult.xml file and you will see the reason way, class is not public ;-)

    <results>
      <test-case name="Tests.Tests.FailingTest" executed="False">
        <reason>
          <message><![CDATA[Fixture class is not public]]></message>
        </reason>
      </test-case>
      <test-case name="Tests.Tests.PassingTest" executed="False">
        <reason>
          <message><![CDATA[Fixture class is not public]]></message>
        </reason>
      </test-case>
    </results>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

nunit-console not run tests with TestCase and TestCaseSource

From Dev

How to run unit tests in nunit latest version(3.0.5813) in console

From Dev

Run all tests in nunit3-console with unset category

From Dev

Is there any way to run Jubula tests from console?

From Dev

Sbt won't run ScalaTest tests

From Java

Jetpack compose: Android Tests won't run

From Dev

Azure Notebook won't run any python

From Dev

Nunit3-console : Console.Writeln won't show up

From Dev

Why doesn't Minitest run any tests?

From Dev

Run NUnit tests in .NET Core

From Dev

How to run nunit tests iteratively

From Dev

Run NUnit tests in release mode

From Dev

Grails 2.3 Migration Scripts Won't Run During Integration Tests

From Dev

IntelliJ IDEA won't run PHPUnit 4.0 tests

From Dev

Maven won't run JUnit5 tests

From Dev

Vim Fireplace with nREPL on docker won't run tests

From Dev

Python - aiohttp - Why won't my tests run?

From Dev

Why won't my concern's methods run from the console?

From Dev

Tests are not running correctly with Nunit 3 console

From Dev

Code won't run and does not show any errors either

From Dev

Wine won't run any .exe programs that are installed on other Drives

From Java

Run all tests in same thread NUnit

From Dev

Prevent NUnit tests to run depending on environment

From Dev

NUnit 3: Forbid tests to run in parallel

From Dev

ReSharper silently refuses to run NUnit tests

From Dev

Springseed won't run?

From Dev

Springseed won't run?

From Dev

Superhot won't run

From Dev

Accessing NUnit Console include parameter name inside tests