繁体   English   中英

在装配中找不到测试

[英]The test couldn't be found in the assembly

我试图执行一个示例PNunit测试,但它失败并出现以下错误

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

我已经关注了Pnunit文档,但它没有帮助。

项目参考

这是测试用例

using NUnit.Framework;

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

和test.conf文件

<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>

我编译了代码,将“pnunit35.dll”和“test.conf”文件复制到“ NUnit.Runners.Net4.2.6.4 \\ tools ”文件夹中运行测试

并运行以下命令(在批处理文件中)以启动代理并从Nunit test runner文件夹运行脚本

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

在运行批处理脚本时,测试失败并出现以下错误

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

有人可以看看这个吗?,提前谢谢

您有可能错过了Visual Studio中的NUnit测试适配器

您的处理器架构可能不匹配。 如果您的项目是64位,请转到测试 - >测试设置 - >默认处理器architecure - > x64。

感谢大家,

最后我找到了问题的根本原因,它是与我在项目中使用的NUnit-3.6.0和Nunit.Runner-4.2.6.4不兼容的pNunit版本。

当我搜索这个问题时,我发现pNunit-2.6.4与最新的Nunit-3.6.0不兼容。 所以,我已经将Nunit和NUnit.Runners改为2.6.4。 然后测试没有任何问题。

更新:使用.Net Framework 3.5

Update2: [。 Net Framework 4.5 ]如果您正在使用.Net Framework 4及更高版本,请在兼容模式下启动PNunit-agent。

在文本编辑器中编辑“pnunit-agent.exe.config”文件,并在“配置”中添加以下代码

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

关闭pnunit-agent并重新运行以解决问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM