question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MassTransit.TestFramework InMemoryTestFixture class causes NUnit 3.2.0 to throw "Has no TestFixtures"

See original GitHub issue

Simple class that uses InMemoryTestFixture gives error trying to run tests from Nunit 3.2.0 CLI.

NUnit Console Runner 3.2.0
Copyright (C) 2016 Charlie Poole

Runtime Environment
   OS Version: Microsoft Windows NT 10.0.10240.0
  CLR Version: 4.0.30319.42000

Test Files
    ...ClassLibrary1.dll


Errors and Failures

1) Invalid : ...\ClassLibrary1.dll
Has no TestFixtures

Run Settings
    WorkDirectory: C:\Program Files (x86)\NUnit.org\nunit-console
    ImageRuntimeVersion: 4.0.30319
    ImageTargetFrameworkName: .NETFramework,Version=v4.6
    ImageRequiresX86: False
    ImageRequiresDefaultAppDomainAssemblyResolver: False
    NumberOfTestWorkers: 4

Test Run Summary
  Overall result: Failed
  Test Count: 0, Passed: 0, Failed: 0, Inconclusive: 0, Skipped: 0
  Start time: 2016-03-24 11:48:39Z
    End time: 2016-03-24 11:48:39Z
    Duration: 0.111 seconds

Results (nunit3) saved as TestResult.xml

Class:

namespace ClassLibrary1
{
    using MassTransit.TestFramework;
    using NUnit.Framework;

    [TestFixture]
    public class Class1 : InMemoryTestFixture
    {
    }
}

packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="MassTransit" version="3.2.4" targetFramework="net46" />
  <package id="MassTransit.TestFramework" version="3.2.4" targetFramework="net46" />
  <package id="NewId" version="2.1.3" targetFramework="net46" />
  <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net46" />
  <package id="NUnit" version="3.2.0" targetFramework="net46" />
</packages>

If you remove inheritance from InMemoryTestFixture then test runs successfully.

namespace ClassLibrary1
{
    using NUnit.Framework;

    [TestFixture]
    public class Class1
    {
    }
}
NUnit Console Runner 3.2.0
Copyright (C) 2016 Charlie Poole

Runtime Environment
   OS Version: Microsoft Windows NT 10.0.10240.0
  CLR Version: 4.0.30319.42000

Test Files
    ...\ClassLibrary1.dll


Run Settings
    WorkDirectory: C:\Program Files (x86)\NUnit.org\nunit-console
    ImageRuntimeVersion: 4.0.30319
    ImageTargetFrameworkName: .NETFramework,Version=v4.6
    ImageRequiresX86: False
    ImageRequiresDefaultAppDomainAssemblyResolver: False
    NumberOfTestWorkers: 4

Test Run Summary
  Overall result: Passed
  Test Count: 0, Passed: 0, Failed: 0, Inconclusive: 0, Skipped: 0
  Start time: 2016-03-24 11:53:07Z
    End time: 2016-03-24 11:53:07Z
    Duration: 0.061 seconds

Results (nunit3) saved as TestResult.xml

Also works correctly referencing BusTestFixture directly.

namespace ClassLibrary1
{
    using MassTransit;
    using MassTransit.TestFramework;
    using NUnit.Framework;

    [TestFixture]
    public class Class1 : BusTestFixture
    {
        protected override IBus Bus { get; }
    }
}
NUnit Console Runner 3.2.0
Copyright (C) 2016 Charlie Poole

Runtime Environment
   OS Version: Microsoft Windows NT 10.0.10240.0
  CLR Version: 4.0.30319.42000

Test Files
    ...\ClassLibrary1.dll


Run Settings
    WorkDirectory: C:\Program Files (x86)\NUnit.org\nunit-console
    ImageRuntimeVersion: 4.0.30319
    ImageTargetFrameworkName: .NETFramework,Version=v4.6
    ImageRequiresX86: False
    ImageRequiresDefaultAppDomainAssemblyResolver: False
    NumberOfTestWorkers: 4

Test Run Summary
  Overall result: Passed
  Test Count: 0, Passed: 0, Failed: 0, Inconclusive: 0, Skipped: 0
  Start time: 2016-03-24 11:54:33Z
    End time: 2016-03-24 11:54:33Z
    Duration: 0.073 seconds

Results (nunit3) saved as TestResult.xml

Supposed to be NUnit version issue as works correctly with NUnit 2.6.4, but fails with 3+.

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="MassTransit" version="3.2.4" targetFramework="net46" />
  <package id="MassTransit.TestFramework" version="3.2.4" targetFramework="net46" />
  <package id="NewId" version="2.1.3" targetFramework="net46" />
  <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net46" />
  <package id="NUnit" version="2.6.4" targetFramework="net46" />
</packages>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
phatboygcommented, Jul 15, 2016

This has been merged, so hopefully this won’t be an issue any longer.

0reactions
waynebrantleycommented, Mar 29, 2016

Agree…i tried to update several times without success…but seems to all work now! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

NUnit fail to build test - No Tests discovered
I was able to built tests in Test Explorer and execute. At once I am getting following errors when rebuilding the solution. Unit...
Read more >
Simple IConsume<T> unit test with a mock
Anyone know if the TestFramework for Mass Transit has issues with Nunit 3? The InMemoryTestFixture doesn't get picked up by the nunit3-console.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found