The test couldn't be found in the assembly

397 Views Asked by At

I was trying to execute a sample PNunit tests, but it is failing with the following error

The test xxx couldn't be found in the assembly xxx.dll

I have followed the Pnunit doc, but it is not helpful.

Project Refs

Here is the test case

using NUnit.Framework;

namespace TestLibraries
{
    [TestFixture]
    public class PuniTest
    {
        [Test]
        public void EqualTo19()
        {
            Assert.AreEqual(19, (15 + 4));
        }
    }
}

and the test.conf file

<TestGroup>
  <Variables>
    <Variable name="$agent_host" value="localhost" />
  </Variables>

  <ParallelTests>
      <ParallelTest>
        <Name>Testing</Name>
        <Tests>
          <TestConf>
            <Name>Testing</Name>
            <Assembly>pnunit35.dll</Assembly>
            <TestToRun>TestLibraries.PuniTest.EqualTo19</TestToRun>
            <Machine>$agent_host:8080</Machine>
          </TestConf>
        </Tests>
      </ParallelTest>
    </ParallelTests>

</TestGroup>

I have compiled the code, copied the "pnunit35.dll" and "test.conf" files to "NUnit.Runners.Net4.2.6.4\tools" folder to run the tests

And run the following commands (in batch file) to start the agent and run the scripts from Nunit test runner folder

start pnunit-agent 8080 .
pnunit-launcher test.conf

On running the batch scripts, tests are failing with the following error

The test TestLibraries.PuniTest.EqualTo19 couldn't be found in the assembly pnunit35.dll

Could some body please look into this?, thanks in advance

3

There are 3 best solutions below

0
On

Thanks Everyone,

Finally I found root cause of the problem, it is the pNunit versions which is incompatible with the NUnit-3.6.0 and Nunit.Runner-4.2.6.4 I was using in my project.

When I googled about the issue, I found that pNunit-2.6.4 is not compatible with the latest Nunit-3.6.0. So, I have changed Nunit and NUnit.Runners to 2.6.4. Then the tests worked without any issues.

Update: Use .Net Framework 3.5

Update2: [.Net Framework 4.5] if you are working on .Net Framework 4 and above, start PNunit-agent in compatiblity mode.

Edit "pnunit-agent.exe.config" file in text editor and add the following code in 'configuration'

<startup>
    <supportedRuntime version="v4.0.30319" />
</startup>

Close the pnunit-agent and re-run that will solve the issue

0
On

You may have a processor architecture mismatch. If your project is 64bit, go to test -> test settings -> default processor architecure -> x64.

2
On

There is a chance you're missing the NUnit Test Adapter in Visual Studio.