473,320 Members | 2,094 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,320 software developers and data experts.

How are people unit testing in ASP.NET 2.0?

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 solution,
and TestDriven.net has no support for web applications.

The best I have found is to use NUnit on the .dll that is created when
the site is published. However, I have found that this .dll is not
updated with each publish, instead new "App_Web_variousgarbage.dll"
files are added to the folder. NUnit doesn't pick up the changes from
those files, so the tests remain the same from the first publish. The
problem is solved if I delete the contents of the folder, but that
leaves me with a rather unsatisfactory 3 step process (Delete, Publish,
Run Tests). There has to be a better way!

What are other people using to run unit tests on ASP.NET 2.0? Ideally,
I'm looking for a one click solution.

Thanks,
Eric

Jan 2 '07 #1
8 1422
Well first, you can use the Web Application Project (free)
http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx to make 2005 web
projects behave like 2003 - which'll solve your assembly name issue. I use
it almost exclusively.

Secondly, I hardly test my presentation layer - it's too much of a hassle
for too little gain. Unit tests work better against your domain layer, your
data access layer and database integration. I do test class files within
web projects (as best I can), but not my aspx and .aspx.cs files...If that's
what you want,the Web Application Project will work for you.

There is something called NUnitASP out there...haven't used it in years, but
back in the day it wasn't great (http://nunitasp.sourceforge.net/).

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Eric" <ve****@gmail.comwrote in message
news:11********************@k21g2000cwa.googlegrou ps.com...
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 solution,
and TestDriven.net has no support for web applications.

The best I have found is to use NUnit on the .dll that is created when
the site is published. However, I have found that this .dll is not
updated with each publish, instead new "App_Web_variousgarbage.dll"
files are added to the folder. NUnit doesn't pick up the changes from
those files, so the tests remain the same from the first publish. The
problem is solved if I delete the contents of the folder, but that
leaves me with a rather unsatisfactory 3 step process (Delete, Publish,
Run Tests). There has to be a better way!

What are other people using to run unit tests on ASP.NET 2.0? Ideally,
I'm looking for a one click solution.

Thanks,
Eric
Jan 2 '07 #2
On Tue, 2 Jan 2007 12:48:52 -0500, "Karl Seguin"
<ka********@removeopenmymindremovemetoo.andmenetwr ote:
>Well first, you can use the Web Application Project (free)
http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx to make 2005 web
projects behave like 2003 - which'll solve your assembly name issue. I use
it almost exclusively.

Karl
Web App Projects are not built into VS2005 with SP1.

Personally I wouldn't unit test the UI code. Extract all of the real
logical/data code to separate projects (which should be done anyways)
and unit test those dll's.

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
Jan 2 '07 #3
Hi,

Samuel R. Neff wrote:
Web App Projects are not built into VS2005 with SP1.
I believe you mean they are *now* built in.

Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 2 '07 #4
I'm with you on not using unit tests for the UI code. I would just be
trying to test the objects that hold the business logic. Currently I
have these objects in their own namespace, but still in the web
application project; however, it shouldn't be too difficult to move
them to their own class library.

Anyone else have a solution for unit testing in asp.net? Do most
people not use unit tests?

Samuel R. Neff wrote:
On Tue, 2 Jan 2007 12:48:52 -0500, "Karl Seguin"
<ka********@removeopenmymindremovemetoo.andmenetwr ote:
Well first, you can use the Web Application Project (free)
http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx to make 2005 web
projects behave like 2003 - which'll solve your assembly name issue. I use
it almost exclusively.

Karl

Web App Projects are not built into VS2005 with SP1.

Personally I wouldn't unit test the UI code. Extract all of the real
logical/data code to separate projects (which should be done anyways)
and unit test those dll's.

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
Jan 2 '07 #5


yeah, now :)

On Tue, 02 Jan 2007 19:12:12 +0100, "Laurent Bugnion [MVP]"
<ga*********@bluewin.chwrote:
>Hi,

Samuel R. Neff wrote:
>Web App Projects are not built into VS2005 with SP1.

I believe you mean they are *now* built in.

Greetings,
Laurent
------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
Jan 2 '07 #6

That's pretty much what I said...I just don't think a complete physical
separation is necessary (or even always possible). I want my HttpHandlers
as part of my web projects, and I can write them in such a way that they are
partially testable...

Karl
--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Samuel R. Neff" <sa********@nomail.comwrote in message
news:88********************************@4ax.com...
On Tue, 2 Jan 2007 12:48:52 -0500, "Karl Seguin"
<ka********@removeopenmymindremovemetoo.andmenetwr ote:
>>Well first, you can use the Web Application Project (free)
http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx to make 2005 web
projects behave like 2003 - which'll solve your assembly name issue. I use
it almost exclusively.

Karl

Web App Projects are not built into VS2005 with SP1.

Personally I wouldn't unit test the UI code. Extract all of the real
logical/data code to separate projects (which should be done anyways)
and unit test those dll's.

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

Jan 2 '07 #7
What about what I first said? About using the a Web Application Project
instead of a Website? They are two different projects in VS.NET...

The behaviour that you described is that of a "Website" project...if you use
a Web Application Project, you won't have Ap_Web variousgarbage.dll -
you'll have a properly (and predictably) named dll.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Eric" <ve****@gmail.comwrote in message
news:11*********************@n51g2000cwc.googlegro ups.com...
I'm with you on not using unit tests for the UI code. I would just be
trying to test the objects that hold the business logic. Currently I
have these objects in their own namespace, but still in the web
application project; however, it shouldn't be too difficult to move
them to their own class library.

Anyone else have a solution for unit testing in asp.net? Do most
people not use unit tests?

Samuel R. Neff wrote:
>On Tue, 2 Jan 2007 12:48:52 -0500, "Karl Seguin"
<ka********@removeopenmymindremovemetoo.andmenetw rote:
>Well first, you can use the Web Application Project (free)
http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx to make 2005 web
projects behave like 2003 - which'll solve your assembly name issue. I
use
it almost exclusively.

Karl

Web App Projects are not built into VS2005 with SP1.

Personally I wouldn't unit test the UI code. Extract all of the real
logical/data code to separate projects (which should be done anyways)
and unit test those dll's.

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
Jan 2 '07 #8
You can try SWExplorerAutomation SWEA (http://WebiusSoft.com). SWEA
allows to write NUnit tests for any Web application.
Eric wrote:
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 solution,
and TestDriven.net has no support for web applications.

The best I have found is to use NUnit on the .dll that is created when
the site is published. However, I have found that this .dll is not
updated with each publish, instead new "App_Web_variousgarbage.dll"
files are added to the folder. NUnit doesn't pick up the changes from
those files, so the tests remain the same from the first publish. The
problem is solved if I delete the contents of the folder, but that
leaves me with a rather unsatisfactory 3 step process (Delete, Publish,
Run Tests). There has to be a better way!

What are other people using to run unit tests on ASP.NET 2.0? Ideally,
I'm looking for a one click solution.

Thanks,
Eric
Jan 3 '07 #9

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...
11
by: rhat | last post by:
Hi Everyone, I've recently been reading some articles about unit-testing in Python , but I am a bit confused: where do I go to get started with this? I tried googling for "unittest" but all I've...
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: ...
7
by: Diffident | last post by:
Hello All, Can anyone please suggest me a good unit testing tool. I have seen NUnit but not sure on how I can use it to test my methods which involve session variables, viewstate variables,...
4
by: Dat AU DUONG | last post by:
Hi, I am new to Unit testing, could you tell me where I could find information (hopefully step by step) and what is the benefit of unit testing. I am a sole developer in a company, therefore I...
176
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write...
48
by: Ark Khasin | last post by:
Unit testing is an integral component of both "formal" and "agile" models of development. Alas, it involves a significant amount of tedious labor. There are test automation tools out there but...
5
by: Ben Finney | last post by:
Howdy all, PEP 299 <URL:http://www.python.org/dev/peps/pep-0299details an enhancement for entry points to Python programs: a module attribute (named '__main__') that will be automatically called...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.