473,382 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Unit Testing an ASP.NET Website using VS2008 Pro

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.
Jun 27 '08 #1
2 2838
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! |
********************************************
<dm*****@gmail.comwrote in message
news:a2**********************************@e39g2000 hsf.googlegroups.com...
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.
Jun 27 '08 #2
On Jun 12, 2:08*pm, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamMwrote:
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. ..@gmail.comwrote in message

news:a2**********************************@e39g2000 hsf.googlegroups.com...
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?
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Hugh Cowan | last post by:
Hello, I don't program full-time (anymore), but I do try and stay on-top of the latest technologies and like most are always trying to upgrade my skills and remain current (as much as is...
5
by: Pete | last post by:
Hi folks, I've been looking at unit testing frameworks (csUnit, NUnit, etc) and have gathered some info on them (see the older thread on c# 2004). My question is this: how do they work with...
14
by: | last post by:
Hi! I'm looking for unit-testing tools for .NET. Somthing like Java has --> http://www.junit.org regards, gicio
15
by: Enrique | last post by:
Question I am posting this question again (3rd time) because some issues with my no spam alias. Here it is the question: I have not been able to run unit tests for a VSTO (2005) project. I...
4
by: Peter Rilling | last post by:
Does VS.NET 2005 Professional support integrated unit testing, or is that only with the team system?
72
by: Jacob | last post by:
I have compiled a set og unit testing recommendations based on my own experience on the concept. Feedback and suggestions for improvements are appreciated: ...
25
by: acemtp | last post by:
Hello, I would like to show you a new collaborative website for javascript programmer. It's quite hard to know if some specific code you wrote will work on all browsers, and if not, why it...
8
by: Eric | last post by:
I've spent some time this morning looking into unit testing frameworks for ASP.NET 2.0, but none seem satisfactory. I don't have Visual Studio Team Edition, so apparently I can't use Microsoft's...
0
by: =?Utf-8?B?T21lbg==?= | last post by:
I also have this issue. If, like VS2005, i would have expected the Web Application to compile all the code into a single DLL file. This does seem to happen and the DLL is there in the Bin...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.