【问题标题】:How to run webtests from a TFS build using powershell script如何使用 powershell 脚本从 TFS 构建运行 webtests
【发布时间】:2019-10-27 12:39:00
【问题描述】:

我需要通过构建运行位于特定文件夹中的 webtests。目前测试是从 Visual Studio 2015 运行的。 知道执行/使用下面的 powershell 脚本作为任务。但不知道如何实现它。这个powershell脚本足够了吗?

param 
(
$tool = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe",
$path ,
$include = "*.webtest" 
 )
$web_tests = get-ChildItem -Path $paths -Recurse -Include $include
foreach ($item in $web_tests) {
$args += "/TestContainer:$item"
}

在此,如何传入 $path 值?我是否需要提供包含所有这 5 个 webtests 的目录的路径? 我是否需要一个 testsettings 文件来执行此执行。

如果我需要测试设置文件,是否需要将所有 webtests 文件复制到输出目录?

我使用这个 powershell 得到的只是以下消息

 No test runs are available for this build. Enable automated tests in 
 your build definition by adding a task that runs tests for your test 
 framework of choice, such as the Visual Studio Test task. If you choose 
 to run tests using a custom task or runner, you can publish results 
 using the Publish Test Results task

任何人都可以像我在这里缺少的那样帮助我吗?感谢您的时间和帮助。

【问题讨论】:

  • 只是检查提供的信息是否有用。如果您需要进一步的帮助,请告诉我们。

标签: azure powershell tfs build azure-devops


【解决方案1】:

如何传入$path值?

当您使用powershell task 执行您的powershell 脚本时,有一个选项Arguments,您可以传递$path 的值:

我是否需要提供所有这 5 个目录的路径 网络测试?

是的。一般情况下,.webtests 文件都会复制到 drop 位置,因此路径始终指向 drop 位置。

我是否需要一个 testsettings 文件来执行此操作。

简短的回答是肯定的。

有一个很棒的博客关于如何Running WebTests as part of a VSTS VNext Release pipeline,你可以看看它是否有帮助。

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-17
    • 2016-11-22
    • 1970-01-01
    • 1970-01-01
    • 2016-05-31
    • 2013-08-18
    • 2015-12-18
    相关资源
    最近更新 更多