BlockLeftTop, PRELOAD BlockLeftBottom, PRELOAD BlockLeftStretch, PRELOAD BlockTop, PRELOAD BlockBottom, PRELOAD BlockStretch, PRELOAD BlockRightTop, PRELOAD BlockRightBottom, PRELOAD BlockRightStretch, PRELOAD
DeltaEngine

Unit testing for web sites

by Benjamin Nitschke 13. April 2007 08:42
Just found this by accident: NUnitAsp. Seems to be very useful. I was always wondering why TestDriven.NET does not support testing web sites or services. It gives you the following message if you try to run tests from a website:
  • Can't execute tests in 'Web Site' application.
There are probably other reasons why this does not work yet, but maybe it is possible to find a way around that. Currently I use a extra project and call the web site or web service from there with my custom methods. It looks much cleaner with NUnitAsp. For me it would even be better if I could write and run unit tests directly on the website without that extra project. Maybe I should drop Jamie Cansdale of TestDriven.NET a short message asking him for some support in the future for ASP.NET. There does not seem to be anything on his blog about ASP.NET yet, at least the search returned 0 results.

Here is a little example from NUnitAsp, which shows you how to test a label on a website:

[Test]
public void TestExample()
{
  // First, instantiate "Tester" objects:
  LabelTester label = new LabelTester("textLabel", CurrentWebForm);
  LinkButtonTester link = new LinkButtonTester("linkButton", CurrentWebForm);

  // Second, visit the page being tested:
  Browser.GetPage("http://localhost/example/example.aspx");

  // Third, use tester objects to test the page:
  AssertEquals("Not clicked.", label.Text);
  link.Click();
  AssertEquals("Clicked once.", label.Text);
  link.Click();
  AssertEquals("Clicked twice.", label.Text);
}

Comments


4/11/2010 7:01:49 AM #

Our work is the presentation of our capabilities.

payday loans | Reply



4/18/2010 5:35:50 PM #

Hi, I’ve been a lurker around your blog for a few months. I love this article and your entire site! Looking forward to reading more!

us | Reply



4/28/2010 6:20:52 AM #

I\'m happy I found this blog, I couldnt discover any info on this subject matter prior to. I also run a site and if you want to ever serious in a little bit of guest writing for me if possible feel free to let me know, i\'m always look for people to check out my site. Please stop by and leave a comment sometime!

Rapidshare | Reply



5/4/2010 10:40:47 PM #

Just found this by accident: NUnitAsp.  Seems to be very useful.  I was always wondering why TestDriven.

Rapidshare Search engine | Reply



5/20/2010 5:09:21 AM #

Useful information, many thanks to the author. It is puzzling to me now, but in general, the usefulness and significance is overwhelming. Very much thanks again and good luck!

payday loans | Reply


Add comment




biuquote
  • Comment
  • Preview
Loading



Disclaimer: The opinions expressed in this blog are own personal opinions and do not represent the companies view.
© 2000-2011 exDream GmbH & MobileBits GmbH. All rights reserved. Legal/Impressum

Poll

Which platform should Soulcraft be released on next?











Show Results Poll Archive

Recent Games

Soulcraft

Fireburst

Jobs @ exDream

Calendar

<<  May 2012  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910