How do you test bl in n-tier

Posts   
 
    
erichar11
User
Posts: 268
Joined: 08-Dec-2003
# Posted on: 21-Oct-2004 20:00:54   

I have a web application solution which is divided into 3 tiers (pl, bl, dl) and at times I just want to test the bl layer. I also use unit testing (UNit) and I can setup simple tests (via Nunit) to test the bl but the problem I'm having is not being able to step through the code when running a unit test. So how do other accomplish this? I resulted to setting up a seperate bl test solution which I can run, test, debug and step through the code and has a simple console app. Problem is, I'm constantly having to switch between my test bll solution and the application solution. Just curious as to what other do. Should I just add another project to my web app solution thats a console app where I can test just the bl rather than having to load the pl? Thanks.

erichar11
User
Posts: 268
Joined: 08-Dec-2003
# Posted on: 21-Oct-2004 20:22:15   

OK, I may have found a solution using nuint addin. Will update shortly

wayne avatar
wayne
User
Posts: 611
Joined: 07-Apr-2004
# Posted on: 21-Oct-2004 20:29:45   

also use unit testing (UNit) and I can setup simple tests (via Nunit) to test the bl but the problem I'm having is not being able to step through the code when running a unit test.

Open BL Project then... Tools -> Debug Process -> Select NUNit - Attach.

Place breakpoints on test - run test from NUnit - whalla !! debugger works simple_smile

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 21-Oct-2004 21:00:40   

I'd suggest TestDriven.NET. It's an MbUnit clone, which offers unittesting directly from vs.net. What's better: you can run a unittest with debugger directly with 1 mouseclick simple_smile Great timesaver simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 22-Oct-2004 00:47:34   

99% of all projects I create have projects that are specifically for unit testing.

Someday, I will get around to making an automated build process. At that time, all my projects will be unit tested by the automated build process.

I use Waynes approach. That approach will even work with command line unit testing.

erichar11
User
Posts: 268
Joined: 08-Dec-2003
# Posted on: 22-Oct-2004 07:54:47   

thanks everyone, I got nunit addin to work (TestDriven.net) and it works great. I can debug unit test stuck_out_tongue_winking_eye Thanks

mattsmith321 avatar
Posts: 146
Joined: 04-Oct-2004
# Posted on: 23-Oct-2004 04:18:55   

wayne wrote:

also use unit testing (UNit) and I can setup simple tests (via Nunit) to test the bl but the problem I'm having is not being able to step through the code when running a unit test.

Open BL Project then... Tools -> Debug Process -> Select NUNit - Attach.

Place breakpoints on test - run test from NUnit - whalla !! debugger works simple_smile

I second this method. Works great!

Another thing that I recommend, while not strictly unit testing the BL, it does a great job of product testing: ASPNUnit. It actually tests pages for you and because ASP.Net adds ID fields to all of it's objects, when ASPNUnit tests a page, it can check for the existence and state of those fields. I've used it on projects at my day job.

swallace
User
Posts: 648
Joined: 18-Aug-2003
# Posted on: 25-Oct-2004 14:28:22   

Ok, that's the first time that's happened to me, but Google doesn't find any relevant links to ASPNunit.

Do you have an URL?

mattsmith321 avatar
Posts: 146
Joined: 04-Oct-2004
# Posted on: 25-Oct-2004 20:06:01   

swallace wrote:

Ok, that's the first time that's happened to me, but Google doesn't find any relevant links to ASPNunit.

Do you have an URL?

Oops! I haven't worked with it in a couple of months. The name is actually NUnitASP. The SourceForge project page is at http://sourceforge.net/projects/nunitasp/.

Sorry about that.