I have Visual Studio 2012 solution that builds into a static library (.lib) (scons build is available partially) and tests for this code that are written using Google Test framework (compiled into .exe with its own main() function).
How can I get test coverage analysis for this solution from command line using Visual Studio 2012 built-in tools or any free VS2012-unrelated software?
Finally I've managed to do this.
First you need to instrument *.exe files that are used to run Google tests (use /Exclude to avoid generating coverage for unwanted namespaces. as my investigation shows, '*' wildcard works in the end of statements only):
vsinstr.exe" mygtests.exe" /COVERAGE /Exclude:std::*
Note: You need to use vsinstr for proper architecture. Use full path in case you are not sure what kind of vsinstr is default
Then you need to start tests execution monitoring (Check architecture too):
VSPerfcmd.exe" /START:COVERAGE /OUTPUT:tests.coverage /cs /user:Everyone
After that run your *.exe file(s) as usual.
In the end of execution use the following to complete collecting of coverage:
VSPerfcmd.exe" -SHUTDOWN
You can now get coverage results in tests.coverage file.
Related
I've added a Blank Node.js Web Application project to my solution. It is a *.njsproj the among of other C# *.csproj projects.
The project works fine. Visual Studio build runs npm run build according the package.json. There is only one thing bothering me. The *.njsproj is built everytime I build the solution.
Visual Studio can recognize when there is no change in the C# *.csproj projects and skips them saying they are up-to-date:
========== Build: 1 succeeded, 0 failed, 29 up-to-date, 0 skipped ==========
However, this does not work for the *.njsproj. The npm run build (raised from AfterCompile target in Microsoft.NodejsToolsV2.targets) is executed every single time even though there is absolutely no change in any of the solution projects or files at all.
Is Visual Studio even able to track changes of Node.js project to skip the build or there is no chance to make it work similar to the C# projects?
All the Node.js project files have Build Action set to None.
I think it is impossible. This is related to the VS IDE's internal build mechanism for Node JS projects of this type. And it is designed by that.
And I should tell you that the up-to-date check is a feature for VS IDE. You can try the VS IDE Build and MSBuild command line build msbuild xxx\xxx.csproj -t:build with the c# project, and you will find that:
IDE build will not execute any msbuild system target, and it detects that it should not build again since there is no changes to minimize the workload of MSBuild.
However, when you use msbuild command line, no matter there is no changes, it still invokes the many system default targets which will make a burden with a large solution.
So the up-to-date is a feature for VS IDE which will helps reduce the burden of msbuild.
We could only modify target one by one to skip by inputs, outputs. But this is meaningless since up-to-date is a new detection mechanism which is not dependent on MSBuild and Targets. There is no msbuild function to get the up-to-date under node js projects.
That is an internal mechanism We cannot handle that area, you need to contact the Microsoft product team by VS IDE menu-->Help-->Send Feedback-->Report a problem or that.
So I've downloaded VS2012 RTM and upgraded my Coded UI test projects to the VS2012 versions.
The reason I have done this is because I was having issues with VS2010 Coded UI tools due to partial support of IE9.
So I ran the tests from my developer machine both locally and remotely (making use of the new Visual Studio agent tools), and the tests worked successfully. Presumably, the reason my tests now work is that VS2012 upgraded them so that they now work with IE9, right?
So - this is my problem. I want to automate these tests, by launching them from our build machine - but our build machine still runs on VS2010, and for the time-being this is not going to change.
So I checked in my new VS2012 Coded UI test solution into TFS and queued a new build - so the build machine built my solution. And the build was successful. All good there.
So, next I created a new test case in Microsoft Test Manager and associated with the ordered test list in my new solution. Then I launched the tests (using the existing VS2010 test controller) on my remote test environment (which has the existing VS2010 test agent tools).
But the tests failed - the same issues that affected my tests with the VS2010 Coded UI tests (due to lack of full support for IE9)
Why did they fail?
Do I need the new VS 2012 agent tools for my test controller and agents? Must I build my solution in VS2012?
Ideally, I don't want to have to install VS2012 RTM on my build machine - I want to do the minimum possible to get my tests working and automating.
Is there a way around this?
Your coded ui tests reference assemblies that come with VS installation or your agent's installation (the assemblies defininf the WpfControl, Mouse, Keyboard, Playback and other classes).
So if you run it on a build/test machine with older versions of the dll's the same issues are going to stay, the tests will not start using the newer fixed assemblies thatt were shipped with VS2012.
As a temporary workaround you can check what dll's you reference and make sure that the build process puts them in the same directory with your tests assembly. That way the lookup for them will find the in the current directory without using the /path and finding them in the VS installation directory.
I am using Windows 8 Pro and Visual Studio 2012 Ultimate (both RTM).
I create a Metro-style class library, and then a corresponding unit test library. Both target WinRT (not the .NET framework).
I can run unit tests fine, but when I attempt to "Analyze code coverage for all tests", the output window comes up with the results of the rebuild, and that's it. The Code Coverage Results window is all grayed out.
From reading on the web, some have alluded to the idea that code coverage is not enabled for WinRT assemblies, but I cannot confirm. I have also tried creating a .testsettings file, like was needed in VS2010 and explicitly turn on code coverage, and I got the same results.
Can anyone confirm or deny that code coverage is not available for WinRT-targeted assemblies, in VS2012 RTM?? I'm just trying to figure out if I'm missing some setting - or if it's not possible.
It's not possible at this stage due to the sandboxed nature of WinRT apps.
P.S. It's on the list of things the team is looking to resolve in the near future (no, I don't have a timeframe for it)
Any suggestions? Code and artwork/assets are all in SVN, and we don't want to port it to GCC or another compiler before anyone suggests it!
Simplicity and minimising 3rd-party tools is preferred, since we don't have a build-server it'll probably still be run on a developer's PC but we don't want them just doing a build manually and packaging it up.
It's basically just a C++ solution with several projects, plus we have an Inno Setup installer to build.
Right now it's a 3-step process (or 4 if you include uploading the release to FTP):
Get from SVN
Build solution from VC++
Run Inno to create the packaged
installer
You can use MSVC pre, post & custom build steps to do this, they run programs through the windows command line. also see this: http://blogs.msdn.com/b/visualstudio/archive/2010/04/26/custom-build-steps-tools-and-events.aspx
If you can't do it with the VS build steps (see Necrolis' answer), then in the past I've used makefiles run with nmake, which is included with VS (you need to start a command prompt with the right environment settings for VS - there's a shortcut on the start menu.)
Nowadays I use FinalBuilder ( http://www.finalbuilder.com/home.aspx ) for all this sort of stuff, which is expensive and doesn't meet your 'not 3rd party' desire, but is an excellent tool. Once you get into it, you'll realise that there are probably far more steps you'd like to do than merely compiling/packaging - you probably want to be incrementing version numbers, moving files around, creating directories, etc. FB is good at that sort of stuff.
I am adding up to date answer for other users:
Currently there is 3rd party extension available which integrates Inno Setup into Visual Studio and allows you to build installers directly from IDE (or from command line using MSBuild).
It is possible to use pre, post & custom build steps, batch files, code signing, running programs through the windows command line etc.
Check Visual Studio Marketplace for more info about Visual & Installer: https://marketplace.visualstudio.com/items?itemName=unSignedsro.VisualInstaller
i have developed application in visual c++ 6.0,i have do exe of that application,i have done by using icnt.exe(install creator),but when i run my application exe file on other system which does't have the vc++ software it's showing dll files are missing,how could than i downloaded the dll files again it is asking other dll's files.i want run my application without installing vc++ software in windows,how can i solve it,plz help me i'm touble.
How to make Realease build? by default its debug build
thanks for reply.
As a wild guess, you have deployed the Debug build, which depends on DLLs that are not allowed to be shipped.
If that is the case, have VC6 create a Release build and deploy that.
You can verify which DLLs are required by your application with the depends.exe utility that came with Visual Studio.
Edit: The easiest way to get a release build when ready is to use the Batch Build command from the Build menu. It will let you pick among all of the known build types in the project, and choose to either build them clean (recommended) or to just bring them up to date.
It is also possible to switch the GUI to default to the Release build instead of Debug. That is the right thing to do if you actually need to run the debugger on the Release build. Note that both builds include debug symbols. The differences have more to do with which runtime libraries are linked, and certain optimizations such as making the assert() macro have no effect.