Code Coverage Tools & Visual Studio 2008 Pro - c#

Just wondering what people are using for code coverage tools when using MS Visual Studio 2008 Pro. We are using the built-in MS test project and unit testing tool (the one that come pre-installed with MS VS 2008 pro)!

NCover is a very popular choice.

I would suggest that you go with NUnit for tests and NCover for coverage.

If you use the TestDriven.Net addin you will get a very good unit test runner and NCover thrown in as well. Get the personal developer version. This is realy the best ever addin for visual studio.

Related

ReSharper Unit Test not run in bin directory

Preamble
I know, that this question seems to have anwsers here:
Resharper runs UnitTest from different location
Resharper Unit Test Runner Can't Find Content Files
I have nearly the same problem like ReSharper 10 test runner failing to find AppSettings referenced from external file.
But these answer stated, that the problem should be gone with ReSharper 10.0.2
Question
I included a custom.xml files with custom settings, and I need to read them from my unit test. But my file is not found.
I looked, where the process runs, and included this line
var curdir = Directory.GetCurrentDirectory();
So I found out, that curdir is C:\\Users\\MYUSER\\AppData\\Local\\JetBrains\\Installations\\ReSharperPlatformVs11_000
Now it is obvious that my file cannot be found. After googling it, it found the above mentioned questions. But none of these solutions works for me.
These are my settings:
Visual Studio Configuration
Microsoft Visual Studio Ultimate 2012
Version 11.0.61219.00 Update 5
Microsoft .NET Framework
Version 4.6.01038
Installierte Version: Ultimate
Architecture and Modeling Tools 04940-004-0038003-02857
Team Explorer für Visual Studio 2012 04940-004-0038003-02857
Microsoft Team Explorer für Visual Studio 2012
Visual Basic 2012 04940-004-0038003-02857
Microsoft Visual Basic 2012
Visual C# 2012 04940-004-0038003-02857
Microsoft Visual C# 2012
Visual C++ 2012 04940-004-0038003-02857
Microsoft Visual C++ 2012
Visual F# 2012 04940-004-0038003-02857
Microsoft Visual F# 2012
Windows Phone SDK 8.0 - DEU 04940-004-0038003-02857
Windows Phone SDK 8.0 - DEU
ASP.NET and Web Tools 2012.3.41009
GenerateUnitTest 1.0
Git Source Control Provider 1.0.0.0
JetBrains ReSharper Ultimate 10.0.2 Build 104.0.20151218.120627
Microsoft Advertising SDK for Windows Phone 6.2.923.0
Microsoft Advertising SDK for Windows Phone Build 6.2.923.0
Microsoft XNA Game Studio 4.0
Microsoft XNA Game Studio 4.0
NuGet-Paket-Manager 2.8.60318.667
PreEmptive Analytics Visualizer 1.0
SQL Server Data Tools 11.1.20627.00
Microsoft SQL Server Data Tools
Git Extensions
You don't list any version of NUnit installed, but you tagged this 'nunit' so I'm going to make an assumption you are using it! Further, I'm assuming NUnit >= 3.0... ignore this if otherwise. :-)
NUnit 3.0 stopped changing current directory. It's a bad idea for us to do that anyway and it's a really bad idea with 3.0, when multiple assemblies in differing directories may be running at the same time.
So, assuming still it's an NUnit problem, instead of using a relative path, use TestContext.CurrentContext.TestDirectory as the location of your file.
try this:
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
In my case was fixed when I changed to this setting
The thing that helped me with such issue - I just turned off NUnit 2.x support in ReSharper settings (ReSharper -> Options... -> Tools -> Unit Testing -> NUnit).
I also turned off NUnit 2.x support and even if it has obviously nothing to do with the problem, it solved it (I have ReSharper 2017.3.20180201.111630)
We are using TestCaseSource in our tests.
So the fix for me in Rider version 2021.1.3 was to change Build-->Unit Testing-->NUnit to Test Runner

Is it possible to create a CodedUI test project if you don't have Visual Studio Enterprise?

I would like to automate my winforms testing using CodedUI but it seems that it is only available on Visual Studio Enterprise. Is it possible to create a CodedUI test project if you don't have Visual Studio Enterprise? If not, what are the alternatives to CodedUI?
The answer as far I know is no. You need Enterprise license to use that feature. This post seems to have some more information enter link description here
The answer is yes if you are on VS 2012-2013. There you need just Premium. Enterprise version is only relevant to VS 2015.
Here is the list of all requirements.

How to use MSTEST with Visual Studio 11 Dev Preview?

Exactly as the question says :
How can I MSTEST with Visual Studio 11 Dev Preview ?
I tried to find the mstest.exe but it doesnt exist in its usual location :
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE
I wrote some unit tests and there is no way to run them =\
MSTest has never been part of the Express editions of Visual Studio.
MSTest.exe is present on my PC in the specified location.
OTOH, if you just started writing the tests, you may want to look at xUnit.net, some of the reasons being posted here: Why I'm migrating from MSTest to xUnit.net.
For VS11 there is a runner available as an extension: Prototype xUnit.net Visual Studio 11 Unit Testing Plugin
Like #Darin Dimitrov answered, MSTest is not available in Express edition, and you should install the Ultimate edition from here,
http://msdn.microsoft.com/en-US/vstudio/hh127353

Running Visual Studio 2010 UI tests not on Ultimate

I have built a test with UI automation using Visual Studio 2010 Ultimate. I would like to run the test on computers that have other editions of Visual Studio 2010 installed, not Ultimate. However when I try to use mstest\testcontainer:tests.dll (the dll file of the test with the debug library) there was error that it was missing one of the test files.
Is there a way to run a UI test on a computer without the Ultimate edition? Thanks.
Coded UI Tests only run with VS Ultimate and VS Premium.
Here is an overview showing which VS edition supports which testing features: http://www.microsoft.com/visualstudio/en-us/products.
Here is the screenshot of the link above, just in case the URL shouldn't work anymore one day:
If you're referring to the Coded UI tests, it's only available on the Ultimate or Premium versions of VS2010. If a user is using the Express or Professional, they just won't be able to do it.
If upgrading those users to Ultimate/Premium isn't an option, you might want to look at a different UI testing tool.

Missing code coverage tab in VS localtestrun.testrunconfig?

I am relatively new to unit testing and was attempting to add some code coverage to my unit tests. Yet i can't find the code coverage tab in Visual Studio 2008 in the localtestrun.testrunconfig, is there any missing Add-in or tool?
Thanks,
DMS
As I understand "Code Coverage" is available only in "bigger" editions of Visual Studio 2008. In other words, this feature is NOT available in the "Visual Studio 2008 Professional Edition".
Which edition of Visual Studio 2008 are you using ?
MSDN Link
Go to the menu Test, select Edit test run configuration for your current test run and check enable code coverage. Then perform a run and then on the test run results you can choose to display code coverage.

Categories