【问题标题】:Run automated tests from test plans gives error No test sources found从测试计划运行自动化测试给出错误未找到测试源
【发布时间】:2020-12-01 17:37:25
【问题描述】:

我有一些 NUnit 测试,并通过 the instructions 运行 Azure 测试计划。测试二进制文件从构建脚本构建,该脚本根据说明将测试 dll 链接到管道设置。所有似乎都适用于以下管道

直到 step 4 of Run the automated tests 失败并出现错误:

No test sources found

和

[error]The slice of type 'Execution' is 'Aborted' because of the error : Microsoft.VisualStudio.TestService.VstestAdapter.TestsNotFoundException: No test assemblies found on the test machine matching the source filter criteria or no tests discovered matching test filter criteria. Verify that test assemblies are present on the machine and test filter criteria is correct.

测试日志说

Creating run for selected test assemblies with following parameters SourceFilter: *.dll TestCaseFilter:

我的测试程序集实际上称为MyProject.Test.dll,它是使用这些说明构建的

/p:PackageLocation="$(build.artifactstagingdirectory)\\Test\\"

在运行任何测试的上一步中,工件的下载方式如下:

如果我在 Azure 测试脚本中将 Test run 类型更改为 Test assemblies

我从 Azure 测试计划运行中收到错误提示

但是,可以“发布”新的测试脚本,看起来像这样成功

虽然实际上存在类似的错误,但稍后在下面修复:

[warning]No test assemblies found matching the pattern: **\bin\x64\Release\*Test*.dll.

NUnit 测试在 Visual Studio 中运行良好,构建正常,但我无法触发它们从 Azure Devops 运行,aaargh。那里有两个问题:

  1. 没有将dll 和config 库复制到$(build.artifactstagingdirectory)\\Test\\ 目录的构建任务。我在构建脚本中添加了“复制文件”任务。

  1. 完成后,我可以在“下载工件”阶段看到测试库已下载到测试目录

我将发布管道搜索文件夹设置为包含下载工件的路径

现在测试程序集通过“发布”运行

如何使用“测试运行”选项运行它?

还是有错误:

[error]The slice of type 'Execution' is 'Aborted' because of the error : Microsoft.VisualStudio.TestService.VstestAdapter.TestsNotFoundException: No test assemblies found on the test machine matching the source filter criteria or no tests discovered matching test filter criteria. Verify that test assemblies are present on the machine and test filter criteria is correct

【问题讨论】:

    标签: azure-devops automated-tests


    【解决方案1】:

    根据您的详细描述,test.dll文件应该已经存在于对应的文件夹($(System.DefaultWorkingDirectory)/.../.../Release)中。

    由于您可以在发布管道中成功运行Test Assemblies,因此 VsTest 任务中的搜索路径和过滤器可能是正确的。

    您需要检查Test Case -> Associated Automation中连接到测试用例的.dll文件。

    您需要确保来自 Automated test storage 的 .dll 存在于您的发布工件中。

    也就是说,你需要确保Test Case -> Automated test storage中的.dll是MyProject.Test.dll

    如果不是,则需要重新连接正确的.dll文件。

    这是一个关于 Associate automated tests with test cases 的文档。

    【讨论】:

    • 嗨,感谢您的回答,但我已经这样做了,是的,测试点指向正确的测试库 dll。所以测试程序集运行,但测试运行没有?!!
    • 嗨@rupweb。测试运行可能与测试用例有关。根据我的测试,当测试用例指向不同的测试库 dll 时,测试运行将失败并出现相同的错误,但测试程序集可以成功运行。您可以尝试在 Visual Studio 中重新关联测试用例吗?
    • 在日志中发现xxx.test.dll文件已经下载到指定文件夹,所以我认为路径应该是正确的
    • 是不是因为是NUnit测试,Test Run只能看到VsTest?
    • 嗨@rupweb。据我所知,测试运行可以支持nunit测试。
    猜你喜欢
    • 2021-03-11
    • 2018-08-02
    • 1970-01-01
    • 2019-10-19
    • 1970-01-01
    • 1970-01-01
    • 2018-03-23
    • 1970-01-01
    相关资源
    最近更新 更多