I guess we all know FxCop by Now. But do you know about StyleCop?
StyleCop is a Source Code Style and Consistency Tool.
... FxCop performs its analysis on compiled binaries, while StyleCop analyzes the source code directly. For this reason, FxCop focuses more on the design of the code, while StyleCop focuses on layout, readability and documentation. Most of that information is stripped away during the compilation process, and thus cannot be analyzed by FxCop. ....
See: http://blogs.msdn.com/sourceanalysis/archive/2008/05/23/announcing-the-release-of-microsoft-source-analysis.aspx
Happy Styling!
Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts
Monday, May 4, 2009
Wednesday, April 8, 2009
Generating testrecords for your unittests
If you are using Visual Studio Database Edition you are able to have VS generate testdata for you. Just what we need to have repeatable testresults.
But how does one execute these so called 'Data Generation Plans' from (unittest)code and from your build server?
You can find the answer here:
http://drowningintechnicaldebt.com/blogs/thomaswaldron/archive/2008/01/08/kick-off-a-data-generation-plan-programmtically.aspx
Happy testing!
But how does one execute these so called 'Data Generation Plans' from (unittest)code and from your build server?
You can find the answer here:
http://drowningintechnicaldebt.com/blogs/thomaswaldron/archive/2008/01/08/kick-off-a-data-generation-plan-programmtically.aspx
Happy testing!
Monday, November 3, 2008
My Favorite Code Snippets (Visual Studio)
Below, my ever growing list of my favorite Code Snippets:
- IDisposable: http://gotcodesnippets.com/1136.snippet (replace destructor in the comments with finalizer)
- Singleton: http://www.gotcodesnippets.com/1042.snippet (as per http://www.yoda.arachsys.com/csharp/singleton.html)
happy Snippeting!
Friday, October 31, 2008
Visual Studio Unittest Inheritance
As your project thus your unittests grow and get more complex you might have to use every Object Oriented "trick" in the book to keep your UnitTests lean/mean/fast and flexible. Of course you don't want any redundant (unittest)code so applying inheritance to your unittests might seem a natural step (especially with provider/Inversion Of Control/Plugins beging used more and more).
Inheritance of UnitTests for Visual Studio however, still, is only partly supported by Visual Studio 2005 and Visual Studio 2008 (all editions). You can't define your baseclass/derivedclass in seperate assemblies.
To me this is a big limitation and the "obvious" solutions offered by Microsoft (copy/paste or add twice) for me are no option. I rather go for sharing in my version control system.
Just an other example of why UnitTesting as offered by Visual Studio so far "feels" a bit unmature. Speaking of which: the atrributename of "fixture" is so much more right then "testmethod"...
======== From MSDN =============
A test class is any class that is marked with the TestClass attribute. Test classes can now inherit members from other test classes. This means that you can create reusable tests in base test classes; derived test classes can inherit tests from base test classes. This feature eliminates duplicated test code and gives developers more flexibility while unit-testing production code.
A test class cannot inherit from a class that is in a different assembly. You can circumvent this limitation in the following way:
===============================
For more information:
Visual Studio 2005: http://support.microsoft.com/kb/919649
Visual Studio 2008: http://msdn.microsoft.com/en-us/library/ms182516.aspx
Happy Testing!
Inheritance of UnitTests for Visual Studio however, still, is only partly supported by Visual Studio 2005 and Visual Studio 2008 (all editions). You can't define your baseclass/derivedclass in seperate assemblies.
To me this is a big limitation and the "obvious" solutions offered by Microsoft (copy/paste or add twice) for me are no option. I rather go for sharing in my version control system.
Just an other example of why UnitTesting as offered by Visual Studio so far "feels" a bit unmature. Speaking of which: the atrributename of "fixture" is so much more right then "testmethod"...
======== From MSDN =============
A test class is any class that is marked with the TestClass attribute. Test classes can now inherit members from other test classes. This means that you can create reusable tests in base test classes; derived test classes can inherit tests from base test classes. This feature eliminates duplicated test code and gives developers more flexibility while unit-testing production code.
A test class cannot inherit from a class that is in a different assembly. You can circumvent this limitation in the following way:
- Define your base test class in a source code file and add the file to Project A.
- Add the same source code file to a different project, Project B. To do this, right-click the project in Solution Explorer, click Add, click Existing Item, and then use the Add Existing Item dialog box to select the file.
Although Project B builds into a different assembly, it includes the base test class. Other test classes in Project B can inherit from that base test class
===============================
For more information:
Visual Studio 2005: http://support.microsoft.com/kb/919649
Visual Studio 2008: http://msdn.microsoft.com/en-us/library/ms182516.aspx
Happy Testing!
Subscribe to:
Posts (Atom)