Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How apply Unit tests in ASP.NET webforms

I'm developing a website in asp.net webforms with 3 layers; UI, BLL and DAL The website is already developed, but i like have more control about the unit tests of each form

Pass specific values at specific inputs for i see, if application survives or not.

I already study about NUnit but in webforms in UI layer how can apply these tests?

What i wnat is get some way to test UI (validations) without have to access to the BLL as i was an user.

I'm trying to add the Unit tests to my app but i not sure how to do it!

somebody can help my small-bigger problem?

like image 548
gds03 Avatar asked Oct 25 '22 17:10

gds03


1 Answers

You can add unit test to your UI using one of these tools

  • http://watin.sourceforge.net/
  • http://seleniumhq.org/

With both tools you can generate C# or VB classes that can be used by NUnit. IMHO, UI test are not as reliable as the common unit tests. Bacause timing conditions you may randomly find that some test will fail.

I used both tools and I recommend selenium mainly because you can generate test that can be run against any browser.

Here an example how to use Watin with NUnit http://www.codeproject.com/KB/applications/SimpleUITestHarness.aspx

And here a guide how to use Seleniun with Nunit http://www.lostechies.com/blogs/agilecruz/archive/2009/02/10/how-to-configure-selenium-rc-for-use-in-c-nunit-tests.aspx

like image 196
Claudio Redi Avatar answered Nov 15 '22 13:11

Claudio Redi