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