从VS中的Test Explorer获取测试列表

时间:2014-07-22 21:16:00

标签: visual-studio-2012 testing coded-ui-tests test-explorer

这是一个"高级" /简单的问题。我试图获取VS2012中我的测试资源管理器中填充的所有测试的列表。我想将它与测试列表进行比较,我想知道是否有任何方法可以从测试资源管理器中获取所有名称,例如复制/粘贴,导出到csv或其他任何性质。

2 个答案:

答案 0 :(得分:8)

在“测试资源管理器”中选择所有测试并将其添加到播放列表文件中。播放列表功能需要VS 2012 Update 2.请参阅http://msdn.microsoft.com/en-us/library/hh270865.aspx#BKMK_Create_custom_playlists

答案 1 :(得分:5)

导出的播放列表是XML格式,但我想要一个简单的列表。这是一个powershell脚本,用于剥离XML语法并仅打印测试名称。我从每个测试中删除命名空间信息。如果您想要全名,请移除$index = $child.Test.LastIndexOf(".").Substring($index+1)

[xml] $content = get-content C:\out.xml $children = $content.SelectNodes("Playlist/Add") foreach($child in $children) { $index = $child.Test.LastIndexOf(".") Write-Output $child.Test.Substring($index+1) }