ASP.NET MVC NUnit test template on Visual Studio Gallery

After struggling around for some time now and having several posts of installation failures (in the comments or at StackOverflow) I picked up the idea of Timur and managed to get the project template for NUnit and ASP.NET MVC 3 put together into a Visual Studio Extension. The benefit is, that there is no installation which does registry changes but delegates the merge process of needed registry settings to Visual Studio. This is done via a package-definition file added to the extension. If you want to dig deeper into that I can recommend following to read:

  1. All Your RegKeys Are Belong To Us
  2. Pkgdef and the Experimental Instance in VS 2010

Both articles describe the starting process of Visual Studio and the registry merging well. At current state the extension is only available for Visual Studio 2010 Professional and higher editions. This is only while I am not aware of the fact if it is possible for lower editions to run extension. Maybe I will research about that later and eventually open the extension for all possible editions. You can now find the extension under following download-link: ASP.NET MVC NUnit or via Extension Manager in Visual Studio.

ASP.NET MVC NUnit project template on Visual Studio Gallery

Functionality is the same as before - ok there is no much to improve or change ;-)

ASP.NET MVC 3 with xUnit.net Testproject

This is just a quick one...

As I updated the test-project shipped with ASP.NET MVC 3 some days ago to fit with NUnit I thought it's time to do so as well with xUnit.net (and later maybe with MbUnit - so that all big 4 testing-frameworks could be used).

ASP.NET MVC 3 xUnit Template

You can download the stuff right here or as usual in the download area. Installation is as simple it could be - just unzip and double click the install.bat. The package is both x86 and x64 aware as the installer checks your system and figures out what registry entries to be done. If there are any problems let me know - I'll try to fix 'em.

[Sidenote:] I am aware about the fact that there is an xunit.installer.exe bundled with xUnit.net ;-) which will install templates for ASP.NET MVC 1, 2 and / or 3. These templates provided in my copy are 1:1 taken from the MSTest which are build-in. The installer provided templates differ. (just to clarify)

Building Automated Error Reporting my way

As I read about automated error reporting by Laila Lotfi's article over at Red Gate's Simple Talk community site, I first thought yeah nice that's what we need in good software. But on a second thought I considered that it was not going far enough.

Truly having automated error reporting is quite well but having hundreds or thousands of error's (depending on the amount of sold licenses) depending on same issues is not what I'd like to see and sorting duplicates out is like a job for someone who killes mom and dad. For a second reason much of a developers live and development process is guided by ticket system ((You can find some good comparison regarding issue-tracking systems at wikipedia.org.)). So why not integrated automated error reporting into a consolidating service (which does that ugly sort and compare job) and let it publish new issues to a ticket system? Might not be the best solution in town but sounds even better than nothing - right? Next up here is a small image showing up how it should be done:

automated error reporting schema

  1. So our application reports its unhandled exceptions to the consolidation service (named AER service) which stores the exception report in it's storage. I find it reasonable to store all reported exceptions in a storage (even for those issues which are already reported) because it gives the developer even more scenarios (assuming the exception report contains detailed informations about environment and current stack...) under which circumstances this error appears.
  2. After storing the report it crawls the bugtracker to find a similar issue, if it doesn't it creates a new entry containing necessary informations and even a sort of link to the reports in the storage so that the responsible developer can find additional infos for the exception.

That said I will try to post a little series about reaching this end-scenario. The tools and libraries I choose to achieve this goal are based on the facts that I owned licenses of them already - but I guess it is even achievable with others.

So what I have is:

  1. Red Gate's SmartAssembly 5: this tool does already a nifty job for automated error reporting. To be honest you will need the PRO version to reach the finish line in this scenario, while that is the version which gives you access to the SDK and a self-hosted custom web-service. (You can read about its detailed features and why I chose to give it a shot for automated error reporting here and here)
  2. JetBrain's YouTrack - as they say the fastest issue and bug-tracker. This isn't much the reason why ;-) - I have it so I use it - it has a REST API so I think I can even link it into the set goal.

What do I need (which seems to be not so much at least):

  1. an interface to YouTrack - REST based!
  2. a synchronisation job which is called after an exception gets reported - to decide if an issue has to be created and does so via the mentioned REST based client

First I thought:

This seems to be very pleasant and causing not very much work

But the problems I were facing are:

  1. There is already a C# YouTrack REST client - named YouTrackSharp written by the famous @ hhariri - the JetBrains guru itself. Sadly it is an implementation which uses the JSON API of YouTrack - which is really really broken - so I did not get managed to hook some attachment support in it. Maybe another reason is that I do not know very much about JSONFx which is used in there, too. And the lack of documentation doesn't made it easier for me. So I decided to build up my own REST client for YouTrack - based on the XML REST API using RestSharp which I know pretty well. I named it RestTrack. It isn't 100% finished yet - but it does all I need to create issues, search them, create attachments and so on... I will release the source in near future. As said it isn't such as good as YouTrackSharp (which uses .NET 4 dynamics already) - it's more the old-school way using XML-Attributes but it fits my needs :-)
  2. My second problem was/is that the SmartAssembly documentation in this case is a bit - let's say - lean. So I have to trouble the support really a lot. But they are as always good and gave me lot of stuff at the hand - thanks for that!

Covering the basics here you can expect in the next post some code stuff about RestTrack and how it can be used to search, create and attach files to issues. Stay tuned... and as always: suggestions are pretty well appreciated!