简体   繁体   English

在TFS测试阶段运行C ++单元测试

[英]Run C++ Unit Tests in TFS test stage

I have developed some C++ code with Visual Studio 2015, which I have just committed to my Visual Studio Online repo. 我已经使用Visual Studio 2015开发了一些C ++代码,而我刚刚致力于Visual Studio Online存储库。 I notice it has a Test feature, in the options: Code, Work, Build, Test, Release. 我注意到它在选项中具有Test功能:代码,工作,构建,测试,发布。 When developing the code, I built some Unit Tests, using Visual Studio's built-in test framework. 开发代码时,我使用Visual Studio的内置测试框架构建了一些单元测试。 Can I configure these to be run as part of the Test step in the repo, to ensure future build's pass requirements? 是否可以将它们配置为在回购中作为“测试”步骤的一部分运行,以确保将来的构建通过要求?

my unit tests are currently in the same solution as the code in a .vcxproj file which contains the actual tests as .cpp files. 我的单元测试当前与.vcxproj文件中的代码处于同一解决方案中,该文件将实际测试包含为.cpp文件。

If you just want run unit test, you can simply run it during the build process. 如果您只想运行单元测试,则只需在构建过程中运行它即可。 When you create a build definition with "Visual Studio" under Build tab, it will contain following tasks: 使用“构建”选项卡下的“ Visual Studio”创建构建定义时,它将包含以下任务: 在此处输入图片说明

"Visual Studio Test" is used to run unit testing. “ Visual Studio测试”用于运行单元测试。 Refer to this link for details: Set up automated testing for your builds 请参阅此链接以获取详细信息: 为构建设置自动测试

For the Test tab, it can be used to run more kinks of testing. 对于“测试”选项卡,它可以用于运行更多的测试。 Refer to this link for details: Testing Tools and Services 有关详细信息,请参阅此链接: 测试工具和服务

There's some documentation on msdn about it : https://msdn.microsoft.com/en-us/library/jj155800.aspx 在msdn上有关于它的一些文档: https : //msdn.microsoft.com/en-us/library/jj155800.aspx

Having said that, here's a quick sum up walkthrough with VS2015 to test it : 话虽如此,这是VS2015的快速总结以对其进行测试:

  1. Open VS2015 x64 x86 (or the one suited for your system) Cross Tools Command Prompt (type VS2015 in your start menu). 打开VS2015 x64 x86(或适合您系统的一个)Cross Tools Command Prompt(在开始菜单中键入VS2015)。
  2. Test you can run VCTest.console : > VCTest.console /? 测试您可以运行VCTest.console:> VCTest.console /?
  3. Go in your project directory 进入您的项目目录
  4. Run your project tests : > VCTest.console myProjectTest.dll 运行项目测试:> VCTest.console myProjectTest.dll
  5. Now all you have to do is to write the little scripts that will automate that and integrate them as hook in your repos. 现在,您所要做的就是编写一些小的脚本,这些脚本将使它们自动化,并将它们作为钩子集成到您的存储库中。

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

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