【发布时间】:2016-10-05 23:28:30
【问题描述】:
function LoginNormal
{
$MSTestCall = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe"
$MSTestArguments = @('/testsettings:C:\PerformanceTests\Local.testsettings')
$file="C:\LoadTestsQA\Login_Normal.loadtest"
$MSTestArguments += "/TestContainer:" + $file
& $MSTestCall $MSTestArguments
}
function LoginPeak
{
$MSTestCall = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe"
$MSTestArguments = @('/testsettings:C:\PerformanceTests\Local.testsettings')
$file="C:\LoadTestsQA\Login_Peak.loadtest"
$MSTestArguments += "/TestContainer:" + $file
& $MSTestCall $MSTestArguments
}
LoginNormal
LoginPeak
此 powershell 脚本在 MSTest 的帮助下使用 powershell 执行 Visual Studio 在线负载测试。 即使这个脚本给了我想要的输出,有时任何一个函数都会失败,输出如下:
开始执行...
连接到https://mytestsite.visualstudio.com
初始化
出现一个或多个错误。
失败最终测试结果:
结果顶级测试
-------- ----------------
未执行 c:\performancetests\loadtestsqa\login_normal.loadtest
0/1 个测试通过,1 个未执行
【问题讨论】:
-
这就是你得到的所有(错误)输出吗?
-
@Jocke 当我在 Visual Studio 中打开未执行负载测试的结果文件 .trx 时,我收到以下错误消息:未执行 LoadTest_Peak 警告:仅加载了一部分测试结果,因为测试类型实施不可用。
-
您多久看到一次此错误?马上再运行还会出现吗?
-
@Eddie-MSFT 是的,实际上我有 4 个负载测试,我需要将每个测试运行两次。因此,我创建了一个 powershell 脚本并为每个测试添加了 4 个函数,我将像这样调用该函数两次: LoginNormal LoginPeak TestNormal TestPeak LoginNormal LoginPeak TestNormal TestPeak 如果前 3 个函数在 VSO 中成功创建负载测试,那么有时第 4 个函数一个可能会失败。如果我尝试单独再次运行失败的测试,那么它可能会在 VSO 中创建负载测试。
-
在记事本中打开 .trx 文件时出现异常详细信息:
System.AggregateException:出现一个或多个错误。 ---> Microsoft.VisualStudio.TestService.Client.StorageException:服务器未能对请求进行身份验证。确保 Authorization 标头的值正确形成,包括签名。 RequestId:8d0283a9-0001-003d-2994-h09b6d000000 时间:2016-06-07T08:11:36.8072816Z
标签: powershell mstest azure-devops