简体   繁体   English

如何在VS2015中的TestWindow中创建自定义测试用例

[英]How to create custom test case in TestWindow in VS2015

How I can create custom test case in VSIX extension for Visual Studio 2015? 如何在Visual Studio 2015的VSIX扩展中创建自定义测试用例?

In older version of Visual Studio I was using namespaces 在旧版的Visual Studio中,我使用的是名称空间

  • Microsoft.VisualStudio.TestPlatform Microsoft.VisualStudio.TestPlatform
  • Microsoft.VisualStudio.TestWindow Microsoft.VisualStudio.TestWindow
  • Microsoft.VisualStudio.TestWindow.Core Microsoft.VisualStudio.TestWindow.Core
  • Microsoft.VisualStudio.TestWindow.Interfaces Microsoft.VisualStudio.TestWindow.Interfaces

but these namespaces are in VS2015 (Community) unavailable. 但是这些命名空间在VS2015(社区)中不可用。 Is there any alternatives to create custom test cases parsed from my specific format in VSIX extension? 在VSIX扩展中,有没有其他方法可以根据我的特定格式来创建自定义测试用例?

In recent versions of Visual Studio (2012 and later), they added native support for custom test engines. 在Visual Studio的最新版本(2012及更高版本)中,他们添加了对自定义测试引擎的本机支持。 To write one you would use the following interfaces (which have no documentation to speak of) in the Microsoft.VisualStudio.TestPlatform.ObjectModel namespace: 要编写一个,您可以在Microsoft.VisualStudio.TestPlatform.ObjectModel命名空间中使用以下接口(没有任何文档可谈):

  1. ITestContainer – Represents a file that contains tests ITestContainer –表示一个包含测试的文件
  2. ITestContainerDiscoverer – Finds all files that contain tests ITestContainerDiscoverer –查找包含测试的所有文件
  3. ITestDiscoverer – Finds all tests within a test container ITestDiscoverer –查找测试容器中的所有测试
  4. ITestExecutor – Runs the tests found inside the test container ITestExecutor –运行在测试容器中找到的测试

More Information: 更多信息:

There are some tutorials( 1 )( 2 ) that give step-by-step instructions and example code that use the APIs mentioned above. 有一些教程( 1 )( 2 )提供了使用上述API的逐步说明和示例代码。 Due to the involved nature, I'm not going to repost the entire tutorials here. 由于涉及的性质,我不会在此处重新发布整个教程。 Note, while the posts were originally written against 2012RC, they are still valid for 2012 RTM, 2013, and 2015. 请注意,虽然这些帖子最初是针对2012RC撰写的,但它们仍适用于2012 RTM,2013和2015。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM