Infosys Microsoft Alliance and Solutions blog

Main

January 23, 2008

Unit Test Trust Issue on Vista

Further to my unit testing experiments that I have been blogging about in the last few days, I was playing around with the DashCommerce starter kit. After installing and configuring the site, I started by creating some tests for the code in the App_code folder.

The test creation was successful and I was all set to run. But luck was against me and I got compilation errors regarding missing namespace. As I had mentioned in my earlier blog, the testing happens via private accessor and since its creation happened successfully, ideally I shouldn't  have had a need for adding explicit references and namespaces to my test project.

Continue reading "Unit Test Trust Issue on Vista" »

January 22, 2008

Debugging ASP.NET Unit Tests with VS 2008

In my previous blogs (here and here), I have been discussing about unit testing on an ASP.NET web site that is hosted on IIS. While doing the work on that, I also had a need to debug my test case. The documentation on MSDN talks about putting break points and attaching to w3wp process and then debug the tests.

This however didn't work for me on VS 2008. What worked was adding the System.Diagnostics.Debugger.Break() call in my code and then running the tests like normal. When the code hit the Debugger.Break line, it asked me, which debugger to use and I selected the already open VS 2008 instance and it took me to the correct line of code and i was able to debug.

January 21, 2008

ASP.NET Unit Testing on IIS

In my previous blog I had mentioned about the issue in generating private accessors for ASP.NET code that is hosted on IIS. Does this mean that we can't test the web site if hosted on IIS?

You can, but it will be a bit more complex and you may not be able to cover all scenarios. The idea is to work with the PrivateObject that is available from the test context. In the previous blog, I had talked about a web site with a Calculator class in the App_Code folder that i wanted to test. Let's continue with the same example.

Continue reading "ASP.NET Unit Testing on IIS" »

January 18, 2008

ASP.NET Unit Testing issue on IIS with VS 2008

I was recently trying to dirty my hands on using the Unit test framework that comes with Visual Studio. I decided to give it a try on my newly installed VS 2008. I created a pretty trivial ASP.NET site hosted on IIS with a Calculator class that I put in App_Code folder and generated the tests.

One of the key differences in working with Unit test framework for ASP.NET as compared to other projects like Winform or Class library is that the code in ASP.NET gets compiled dynamicall into various assemblies and hence we can't bind to a specific assembly upfront. Check more details on this here.

Continue reading "ASP.NET Unit Testing issue on IIS with VS 2008" »

Subscribe to this blog's feed

Follow us on

Blogger Profiles

Infosys on Twitter