Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Unit Testing an ASP.NET Website using VS2008 Pro

Reply
Thread Tools

Unit Testing an ASP.NET Website using VS2008 Pro

 
 
dmeglio@gmail.com
Guest
Posts: n/a
 
      06-12-2008
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.
 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      06-12-2008
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! |
********************************************
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.


 
Reply With Quote
 
 
 
 
dmeglio@gmail.com
Guest
Posts: n/a
 
      06-12-2008
On Jun 12, 2:08*pm, "Cowboy \(Gregory A. Beamer\)"
<(E-Mail Removed)> wrote:
> 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 bloghttp://gregorybeamer.spaces.live.com/lists/feed.rss
>
> or just read it:http://gregorybeamer.spaces.live.com/
>
> ********************************************
> | Think outside the box! * * * * * * * * * * * * * * * |
> ********************************************<dmeg. (E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > 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.- Hide quoted text -

>
> - Show quoted text -


Maybe I'm missing something. If I can't run tests on code in
App_Code... why even have App_Code?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Webinar - Testing the Untestable - Unit Testing Dependencies andLegacy Code (in C++) Avi C Programming 0 06-11-2012 01:55 PM
[ANN] Webinar - Testing the Untestable - Unit Testing Dependenciesand Legacy Code in C++ Avi C++ 0 06-06-2012 11:25 AM
unit-profiling, similar to unit-testing Ulrich Eckhardt Python 6 11-18-2011 02:00 AM
Unit testing errors (testing the platform module) John Maclean Python 1 04-13-2010 02:11 PM
Test::Unit - Ruby Unit Testing Framework Questions Bill Mosteller Ruby 0 10-22-2009 02:02 PM



Advertisments