azure - 在 Visual Studio Team Services 中部署后运行集成测试

标签 azure visual-studio-2013 continuous-integration nunit azure-devops

我在 Visual Studio Team Services 中添加了发布定义,以将应用程序部署到 Azure 云服务。我正在尝试在成功部署后运行一些集成测试:

enter image description here

但不幸的是测试没有运行:

Warning: No test is available in C:\a\301532a74\Build\Api.Web.IntegrationTests\Api.Web.IntegrationTests.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.
Information: Additionally, you can try specifying '/UseVsixExtensions' command if the test discoverer & executor is installed on the machine as vsix extensions and your installation supports vsix extensions. Example: vstest.console.exe myTests.dll /UseVsixExtensions:true
##[warning]No results found to publish.

我已经为所有包含测试(单元测试和集成测试)的项目安装了 NUnit 测试适配器(nuget 包)。奇怪的是,我能够将测试作为构建的一部分来运行,但不能作为发布的一部分来运行。

我还尝试设置自定义测试适配器的路径,但似乎没有什么区别。

我在这里缺少什么?有没有更好的方法来运行一些集成测试作为版本的一部分?

最佳答案

这通常是由于 VSTest 找不到 NUnit 测试适配器造成的。

通常,在“构建”环境中,NUnit 测试适配器由 nuget 恢复到工作文件夹中,以便 VSTest 在测试过程中可以找到它。但在“Release”环境中,NUnit 测试适配器默认不存在。因此,您需要更新构建定义以将 NUnit 测试适配器文件上传到“drop”,并且在下载工件后,NUnit 测试适配器将在“Release”环境中可用。然后您可以将“自定义测试适配器的路径”设置为“$(System.DefaultWorkingDirectory)\”并重试。

如果您使用自己的构建代理,您还可以将 NUnit 测试适配器放置在构建代理可以访问的永久路径中,并为其设置“自定义测试适配器的路径”。或者在构建代理上安装 VS 的 NUnit 测试适配器扩展,并在“Visual Studio Test\其他控制台选项”中输入“/UseVsixExtensions:true”。

关于azure - 在 Visual Studio Team Services 中部署后运行集成测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36401066/

相关文章:

azure - Terraform - 使用模块将 Azure VM 导入状态文件

azure - 服务器宕机时如何设置网站默认页面?

mysql - 让 VS2013/SSRS 永久使用 .SQL 文件,而不是手动粘贴/导入数据集查询

Linux 的 C++ 调试器类似于 MS Visual Studio 的调试器?

Azure-functions:可以在 function.json 中使用环境变量吗?

c# - TypeLoadException : Method 'Create' in type . ..没有实现(错误如下)

visual-studio-2013 - 如何扩展 Visual Studio Web 发布管道?

unit-testing - 每晚构建与持续集成 : Long-Running Automated Tests

maven - 如何使用Gradle和Maven settings.xml文件解决和部署依赖项?

javascript - 如何使用 Mocha 配置 TeamCity 构建?