Visual studio 2015 Visual Studio 2015 MSTest无法运行负载测试

Visual studio 2015 Visual Studio 2015 MSTest无法运行负载测试,visual-studio-2015,mstest,load-testing,msloadtest,Visual Studio 2015,Mstest,Load Testing,Msloadtest,我正在尝试运行一个批处理文件,该批处理文件包含运行负载测试文件的MSTest,但它总是返回一条错误消息“执行测试需要Visual Studio Enterprise。”Visual Studio 2015 Enterprise已与MSTest一起安装在我的计算机中 以下是批处理文件的内容: pushd .. "D:\Visual Studio 14.0\Common7\IDE\MSTest.exe" /testcontainer:%arg1% /testsettings:Local.Testse

我正在尝试运行一个批处理文件,该批处理文件包含运行负载测试文件的MSTest,但它总是返回一条错误消息“执行测试需要Visual Studio Enterprise。”Visual Studio 2015 Enterprise已与MSTest一起安装在我的计算机中

以下是批处理文件的内容:

pushd ..
"D:\Visual Studio 14.0\Common7\IDE\MSTest.exe" /testcontainer:%arg1% /testsettings:Local.Testsettings /resultsfile:Scripts\TestResults\%arg2%.trx"
popd
其中:

%arg1%=loadtest.loadtest

%arg2%=loadtest.loadtest.date

Local.Testsettings:x64

作为我的一部分,我在尝试通过TFS/Powershell运行测试时遇到了相同的问题。为了解决这个问题,我采纳了@allen的建议,在运行测试之前调用“Developer Command Prompt”,并在Powershell脚本中实现了一个解决方案,它似乎适用于我测试过的两台服务器,我已将其调整为与BAT兼容:

**注意:这是针对VS 2017的,我相信您只需更改路径中的年份即可调用以前的版本*

(对于@user6329531,BAT版本的修复程序,请在执行测试之前调用它)

(用于运行Microsoft“负载测试”的完整Powershell脚本)

作为测试的一部分,我在尝试通过TFS/Powershell运行测试时遇到了相同的问题。为了解决这个问题,我采纳了@allen的建议,在运行测试之前调用“Developer Command Prompt”,并在Powershell脚本中实现了一个解决方案,它似乎适用于我测试过的两台服务器,我已将其调整为与BAT兼容:

**注意:这是针对VS 2017的,我相信您只需更改路径中的年份即可调用以前的版本*

(对于@user6329531,BAT版本的修复程序,请在执行测试之前调用它)

(用于运行Microsoft“负载测试”的完整Powershell脚本)


Visual Studio的某些部分仅安装在系统驱动器中或从系统驱动器工作,系统驱动器通常为
C:
。批处理文件运行
D:…MStest.exe
。您是否安装了多个Visual Studio版本,并且其中任何一个版本都安装在非系统驱动器上?请从developer命令prompt运行批处理文件Visual Studio的某些部分仅安装到系统驱动器中或从系统驱动器中工作,系统驱动器通常为
C:
。批处理文件运行
D:…MStest.exe
。是否已安装多个Visual Studio版本,并且其中任何一个版本都安装在非系统驱动器上?请从开发人员命令提示符运行批处理文件
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
param (
    [string]$path = ""
 )

#For this to work correctly you need to make sure the following things are done: 
#https://stackoverflow.com/a/53211350/2912011
Write-Output $path

#Start deveng, for some reason it likes to complain if it's not runnning
#https://social.msdn.microsoft.com/Forums/vstudio/en-US/1d5574c0-4a56-4dd1-b390-3a3683278d16/loadtest-require-visual-studio-enterprise?forum=vstest
Start-Process "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\devenv.exe"

#Run the "Developer Command Prompt" 
cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\"
./VsDevCmd.bat

#Navigate to the MSTest directory
cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\"

#Iterate through the entire directory, run each loadtest one at a time
$fullPath = $path

Get-ChildItem $fullPath -Filter *.loadtest | 
Foreach-Object {
    $content = $_.FullName

    Write-Output $content

    ./mstest.exe /testcontainer:"$content" /detail:testtype
}

try {
    Get-Process devenv -IncludeUserName | Where UserName -match EBMTFSServiceAccount| Stop-Process
}
catch {
    #This may fail, if so it probably is not an issue, but we need to double check...
    Write-Output $_.Exception.Message
}