简体   繁体   中英

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.

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.

Now a few things to point out with my project structure:

  1. The test project started out as a basic Visual Studio 2017 Unit Test template, with MS Test.
  2. I preferred NUnit, so I am writing/rewriting the tests using that framework instead of the MSTest it was created with.

My current azure devops pipeline config: 天蓝色 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.

Please follow the below steps may it resolve your issue

  • There is no need to add TestAdapter.dll in Test files
  • uncheck "Test mix contains UI tests"
  • Select test platform using "version" as "Installed by Tools Installer"

or

You might need to search the test dll into $(System.DefaultStagingDirectory) folder. sometimes azure agent place the dlls in staging directory instead of defaultworkingdirectory.

When adding a new NUnit project by the visual studio template like so在此处输入图像描述 It defaults the framework version to 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: 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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