[英]Azure devops - NUnit tests not found when outside of a netcore/template project
I followed the tutorials in the docs for azure devops with regards to running Selenium tests as part of the build.我按照 azure devops 文档中的教程,将 Selenium 测试作为构建的一部分运行。
My local tests run fine with the browsers I have webdrivers installed for, but when the VSTest task runs, it doesn't unpack any tests from anything under NUnit attributes.我的本地测试在我安装了 webdrivers 的浏览器上运行良好,但是当 VSTest 任务运行时,它不会从 NUnit 属性下的任何内容中解压缩任何测试。
Now a few things to point out with my project structure:现在要指出我的项目结构的几件事:
My current azure devops pipeline config:我当前的 azure devops 管道配置:
Working local tests setup:工作本地测试设置:
Now, I can easily add a new project using the NUnit template which for whatever reason allows the azure build to see these tests, but that causes my project structure to change and it defaults to netcoreapp2.1 instead of 4.6, and then the azure build can't find all sorts of stuff.现在,我可以使用 NUnit 模板轻松添加一个新项目,无论出于何种原因,它都允许 azure 构建看到这些测试,但这会导致我的项目结构发生变化,它默认为 netcoreapp2.1 而不是 4.6,然后是 azure 构建各种东西都找不到。
Please follow the below steps may it resolve your issue请按照以下步骤操作可能会解决您的问题
or或者
You might need to search the test dll into $(System.DefaultStagingDirectory) folder.您可能需要在 $(System.DefaultStagingDirectory) 文件夹中搜索测试 dll。 sometimes azure agent place the dlls in staging directory instead of defaultworkingdirectory.
有时 azure 代理将 dll 放在暂存目录而不是默认工作目录中。
When adding a new NUnit project by the visual studio template like so当像这样通过 Visual Studio 模板添加新的 NUnit 项目时
It defaults the framework version to netcoreapp2.1
它默认框架版本为 netcoreapp2.1
If I change this to my build framework (net461), although the build states the same "These dlls will be skipped" message, the NUnit3Adapter is somehow now recognized and picks up the NUnit tests:如果我将其更改为我的构建框架(net461),尽管构建声明相同的“这些 dll 将被跳过”消息,但 NUnit3Adapter 现在以某种方式被识别并获取 NUnit 测试:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.