测试用例未在装配中找到测试

问题描述 投票:0回答:2

我正在尝试在TFS中设置自动化测试。我有一个项目的解决方案和两个单元测试。

我可以在TFS中构建我的解决方案,并将我的测试用例与单元测试相关联。

当我通过TFS运行测试用例时,状态变为“进行中”,我可以看到我的代理接收任务。几秒钟后,代理会提示“作业结果已完成,结果为:SucceededWithIssues”。当我检查代理的日志时,最后一行已完成。

当我返回TFS时,状态仍处于“进行中”状态。

当我单击“运行”图标时,它会立即通过对话框提示我,并显示“查看测试运行”按钮。当我点击那里时,显示“刚刚中止,冉冉03秒”。

Test seklction

谁能帮助我朝正确的方向发展?

UPDATE

我设法追踪一个日志文件:

2019-03-01T08:50:15.6478536Z Total Tests : 1, Passed Tests : 0
2019-03-01T08:50:18.6816644Z Test source filter: **\Tests.dll
2019-03-01T08:50:18.6816644Z Count of test sources found: 0
2019-03-01T08:50:18.6826624Z ##[warning]No test sources found
2019-03-01T08:50:18.6896764Z ##[error]ExecutionTaskStateModel.ExecuteTask: Recived error while executing task: System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: 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.

从我的构建日志中,我得到了这个:

2019-03-01T10:34:58.4371090Z Total tests: 2. Passed: 2. Failed: 0. Skipped: 0.

所以它在正确的位置拾取我的测试,并在构建中传递它们,但不在测试后构建(发布后?)阶段。

所以它正在寻找一个测试,但后来却提示它没有找到测试?我错过了什么?

更新 -

当尝试更改测试选择测试程序集时,系统会提示我此错误消息。 Test run

c# unit-testing tfs automated-tests
2个回答
0
投票

您正在测试您的测试程序集 - 这里是Tests.dll。

尝试在测试选择字段中选择“测试装配”。

然后,您可以直接在“测试装配”列表中添加装配。或者您可以使用以下相对路径(并且不包括obj文件夹):

**\Tests.dll 
!**\obj\**

enter image description here

看看qazxsw poi,了解您可以选择的不同测试方法(测试装配/测试计划/测试运行)

此外,请确保在代理计算机上安装了Visual Studio。否则,看看here


0
投票

问题出在测试案例中。当我将单元测试与测试用例相关联时,单元测试在Test程序集中,因此它试图解析Test.dll。

在测试用例中,右侧有一个选项卡“Associated automation”,其中:

this

© www.soinside.com 2019 - 2024. All rights reserved.