简体   繁体   中英

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. I notice it has a Test feature, in the options: Code, Work, Build, Test, Release. When developing the code, I built some Unit Tests, using Visual Studio's built-in test framework. 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.

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 Test" is used to run unit testing. 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

Having said that, here's a quick sum up walkthrough with VS2015 to test it :

  1. Open VS2015 x64 x86 (or the one suited for your system) Cross Tools Command Prompt (type VS2015 in your start menu).
  2. Test you can run VCTest.console : > VCTest.console /?
  3. Go in your project directory
  4. Run your project tests : > 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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