Re: Unit Testing an ASP.NET Website using VS2008 Pro

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Move your classes from App_Code to their own libraries. Then, you will have no problem using a unit test framework to test your functionality.

The other options are:

1. Publish and set nUnit to point to those files
2. Embed the tests in a subfolder of App_Code and run inside the project (this forces flipping from web app to library, which can be a pain in the ____!

Of course that does not solve the "create stubs" issue, which will be solved when you move your code to a class library project.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

********************************************
| Think outside the box! |
********************************************
<dmeglio@xxxxxxxxx> wrote in message news:a2fba7d6-f7be-454d-8ed2-4dd1ac19161e@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

I've just ported an ASP.NET project from VS 2003 to 2008. In 2003, I
was using NUnit to test. Under 2008, I don't get a single DLL for my
website, so I can't use NUnit anymore. Additionally, I'd prefer to use
the built in VS2008 Pro tools. I don't want to actually test ASPX
functionality, rather I have several classes that are in my App_Code
folder. I can't build a "test project" because there is no DLL for me
to reference so that I can test my App_Code. So, I tried adding the
test cases to a cs file in App_Code directly. First, when I click on a
class and do "Create Unit Tests", it fails with: There was an
unexpected error in displaying the Create Unit Tests Dialog. Please
rebuild and try again.

Naturally, I have tried rebuilding numerous times. Next I tried adding
a reference to Microsoft.VisualStudio.TestTools.UnitTesting and
manually specifying [TestClass] and [TestMethod] it seems that it
still doesn't work. When I try to run the tests, I'm told that there
aren't any.

Does anyone know how I can accomplish this? Again, I'm not looking to
test ASPX functionality, I'm looking to test classes contained in
App_Code, so I don't think that whole UrlToTest() thing is necessary,
or am I wrong?

Thanks in advance.

.



Relevant Pages

  • Re: Unit Testing an ASP.NET Website using VS2008 Pro
    ... Publish and set nUnit to point to those files ... functionality, rather I have several classes that are in my App_Code ... to reference so that I can test my App_Code. ... unexpected error in displaying the Create Unit Tests Dialog. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: client-side Ruby on iPad/iPhone?
    ... Not the standard library, but rather core types. ... before it's a useful Web development language. ... What functionality? ... JQuery and Prototype are huge libraries. ...
    (comp.lang.ruby)
  • Re: Unit Testing a API library
    ... I need some guidance on unit tests. ... Testing libraries is usually pretty easy, ... So my unit test for LibFunc1 would also essentially ... For example, if you can't look at internal values that the FUT changes, how can you tell the FUT changed them properly? ...
    (comp.software.testing)
  • Re: RfD: One-time file loading
    ... >>the means to achieve the functionality. ... If the proposal does not specify what the system ... I hate load screens, and I hate including ... as libraries, and applications that are subdivided over different ...
    (comp.lang.forth)
  • Re: Unit testing - suitable for all development?
    ... > hundreds of unit tests run in a few seconds teaches you ... > how to write code with a minimum of coupling. ... Therefore there's almost no functionality there at all that ... __init__ function relies on calling methods of these objects (not just ...
    (comp.lang.python)