koviroli
koviroli

Reputation: 1453

No test is available in MyProject.dll., but Test Explorer shows them

I can't run Unit Tests in my project, for about 4 days ago, I've already tried a lot of solutions that's existing in SO, but nothing helped me.

No test is available in Path\To\My\TestProject.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

Test Explorer shows my tests, but can't run them.

Btw. These are WPF C# projects.

I have test classes with test methods like this:

    [TestFixture]
    [Category("Something")]
    public class SomeTestClass
    {
        [Test]
        public void SomeMethodThatDoesntWork()
        {
            using (var ms = new MemoryStream())
            {
                System.Diagnostics.Debugger.Launch();
                Option savedOptions = new ....
...

NUnit 2.6.4 because of I have some Attributes like ExpectedExceptionAttribute that is already removed in newer NUnit versions.

I've already set Test\Test Settings\Default Processor Achitecture to x64 and also tried x86.

Test Console Output:

enter image description here

Test Exlorer:

enter image description here

Upvotes: 0

Views: 4317

Answers (3)

Itamar
Itamar

Reputation: 925

What solved it for me was:

  • Go to and SELECT -> 'Test' Tab -> Test Settings -> Default Processor Architecture -> x64**

Run tests.

Upvotes: 1

koviroli
koviroli

Reputation: 1453

Finally solved my problem in about 2 days.

There was DLL dependencies which those Visual Studio couldn't notice and didn't show me any warning or errors. Dependency Walker helped me to find those dependencies of my DLLs.

So what I've learnt again? Visual Studio can be buggy and sometimes isn't really smart.

Upvotes: 1

Lemm
Lemm

Reputation: 196

You can try this i may solve your problem.

Also, you can in latest version of NUnit you can change ExpectedExceptionAttribute attribute to this (or other examples from comments) or just use following asserts:

Assert.Throws<Exception>(() => 
{
    // Test Code
});

Upvotes: 0

Related Questions