August 2007 Blog Posts
In my last post, I wrote about how most email validation routines are too strict when compared against what is allowed by the RFC. Initially I dismissed this phenomena as the result of ignorance of the RFC or inability to understand it, as I had trouble understanding it myself.
However, I think there’s something more fundamental at work here when it comes to validating user data. It seems that many developers, myself included, choose to ignore Postel’s Law when it comes to field validation. Postel’s law states...
Be conservative in what you do; be liberal in what you accept from others.
Postel wrote that in an RFC that defined TCP, but it applies much more broadly. It’s natural that developers, used to the exacting nature of writing code for a compiler, where even the most minor of typos can bring a program screeching to a halt, have a tendency to apply such exactitude on their users.
Dare I say it, but developers can tend to be validation nazis.

User: (filling out form) user+nospam@example.com
Validation Nazi: Entering a plus sign is $2.00 extra.
User: But the RFC allows for a plus sign.
Soup Nazi: You want plus sign?
User: Yes please.
Validation Nazi: $3.00!
User: What?
Validation Nazi: No form submission for you!
This is a mistake. Users are not compilers so we need to cut them some slack.
A List Apart provides some great examples of mistakes in treating users like computers and ways to correct them in the article, Sensible Forms: A Form Usability Checklist. Here’s a snippet about dealing with phone numbers (emphasis mine).
Let the computer, not the user, handle information formatting
Few things confuse users as often as requiring that users provide information in a specific format. Format requirements for information like telephone number fields are particularly common. There are many ways these numbers can be represented:
* (800) 555-1212
* 800-555-1212
* 800.555.1212
* 800 555 1212
Ultimately, the format we likely need is the one that only contains numbers:
* 8005551212
There are three ways to handle this. The first method tells the user that a specific format of input is required and returns them to the form with an error message if they fail to heed this instruction.
The second method is to split the telephone number input into three fields. This method presents the user with two possible striking usability hurdles to overcome. First, the user might try to type the numbers in all at once and get stuck because they’ve just typed their entire telephone number into a box which only accepts three digits. The “ingenious” solution to this problem was to use JavaScript to automatically shift the focus to the next field when the digit limit is achieved. Has anyone else here made a typo in one of these types of forms and gone through the ridiculous process of trying to return focus to what Javascript sees as a completed field? Raise your hands; don’t be shy! Yes, I see all of you.
Be reasonable; are we so afraid of regular expressions that we can’t strip extraneous characters from a single input field? Let the users type their telephone numbers in whatever they please. We can use a little quick programming to filter out what we don’t need.
The recommendation they give fits with Postel’s law by being liberal in what they accept from the user. The computer is really really good at text processing and cleaning up such data, so why not leverage that fast computation, rather than throwing a minor annoyance at your users. No matter how small the annoyance, every little mental annoyance begins to add up. As Jacob Nielsen writes (emphasis his)...
Annoyances matter, because they compound. If the offending state-field drop-down were a site’s only usability violation, I’d happily award the site a gold star for great design. But sites invariably have a multitude of other annoyances, each of which delays users, causes small errors, or results in other unpleasant experiences.
A site that has many user-experience annoyances:
- appears sloppy and unprofessional,
- demands more user time to complete tasks than competing sites that are less annoying, and
- feels somewhat jarring and unpleasant to use, because each annoyance disrupts the user’s flow.
Even if no single annoyance stops users in their tracks or makes them leave the site, the combined negative impact of the annoyances will make users feel less satisfied. Next time they have business to conduct, users are more likely to go to other sites that make them feel better.
However, in the case of the email validation, the problem is much worse. It violates the golden rule of field validation (I’m not sure if there is a golden rule already, but there is now)...
Never ever reject user input when it truly is valid.
In the comments of my last post, several users lamented the fact that they can’t use a clever GMail hack for their email address because most sites (mine included at the time, though I’ve since fixed it) reject the email.
With Gmail you can append a tag to your email address. So let’s say you have "name@gmail.com" you can give someone an email address of "name++sometag@gmail.com" and it will faithfully arrive in your inbox. The use of this for me is that I can track who’s selling my email address or at least who I gave my email to that is now abusing it.
For fun, I wrote a crazy regular expression to attempt to validate an email address correctly according to the RFC, but in the end, this was a case of Regex abuse, not Regex use. But as one commenter pointed out...
THE ONLY WAY TO VALIDATE AN EMAIL ADDRESS IS TO DELIVER A MESSAGE TO IT!
This served to drive home the point that attempting to strictly validate an email address on the client is pointless. The type of validation you do should really depend on the importance of that email address.
For example, when leaving a comment on my form, entering an email address is optional. It’s never displayed, but it allows me to contact you directly if I have a personal response and it also causes your Gravatar to be displayed if you have one. For something like this, I stick with a really really simple email address validation purely for the purpose of avoiding typos...
^.+?@.+$
However, for a site that requires registration (such as a banking site), having the correct email address to reach the user is critical. In that case it might make sense to have the user enter the email twice (to help avoid typos, though most users simply copy and paste so the efficacy of this is questionable) and then follow up with a verification email.
In the end, developers need to loosen up and let users be somewhat liberal about what they enter in a form. It takes more code to clean that up, but that code only needs to be written once, as compared to the many many users who have to suffer through stringent form requirements.
Raise your hand if you know how to validate an email address. For those of you with your hand in the air, put it down quickly before someone sees you. It’s an odd sight to see someone sitting alone at the keyboard raising his or her hand. I was speaking metaphorically.
Before yesterday I would have raised my hand (metaphorically) as well. I needed to validate an email address on the server. Something I’ve done a hundred thousand times (seriously, I counted) using a handy dandy regular expression in my personal library.
This time, for some reason, I decided to take a look at my underlying assumptions. I had never actually read (or even skimmed) the RFC for an email address. I simply based my implementation on my preconceived assumptions about what makes a valid email address. You know what they say about assuming.
What I found out was surprising. Nearly 100% of regular expressions on the web purporting to validate an email address are too strict.
It turns out that the local part of an email address, the part before the @ sign, allows a lot more characters than you’d expect. According to section 2.3.10 of RFC 2821 which defines SMTP, the part before the @ sign is called the local part (the part after being the host domain) and it is only intended to be interpreted by the receiving host...
Consequently, and due to a long history of problems when intermediate hosts have attempted to optimize transport by modifying them, the local-part MUST be interpreted and assigned semantics only by the host specified in the domain part of the address.
Section section 3.4.1 of RFC 2822 goes into more detail about the specification of an email address (emphasis mine).
An addr-spec is a specific Internet identifier that contains a locally interpreted string followed by the at-sign character ("@", ASCII value 64) followed by an Internet domain. The locally interpreted string is either a quoted-string or a dot-atom.
A dot-atom is a dot delimited series of atoms. An atom is defined in section 3.2.4 as a series of alphanumeric characters and may include the following characters (all the ones you need to swear in a comic strip)...
! $ & * - = ^ ` | ~ # % ' + / ? _ { }
Not only that, but it’s also valid (though not recommended and very uncommon) to have quoted local parts which allow pretty much any character. Quoting can be done via the backslash character (what is commonly known as escaping) or via surrounding the local part in double quotes.
RFC 3696, Application Techniques for Checking and Transformation of Names, was written by the author of the SMTP protocol (RFC 2821) as a human readable guide to SMTP. In section 3, he gives some examples of valid email addresses.
These are all valid email addresses!
- "Abc\@def"@example.com
- "Fred Bloggs"@example.com
- "Joe\\Blow"@example.com
- "Abc@def"@example.com
- customer/department=shipping@example.com
- $A12345@example.com
- !def!xyz%abc@example.com
- _somename@example.com
Note: Gotta love the author for using my favorite example person, Joe Blow.
Quick, run these through your favorite email validation method. Do they all pass?
For fun, I decided to try and write a regular expression (yes, I know I now have two problems. Thanks.) that would validate all of these. Here’s what I came up with. (The part in bold is the local part. I am not worrying about checking my assumptions for the domain part for now.)
^(?!\.)("([^"\r\\]|\\["\r\\])*"|([-a-z0-9!#$%&'*+/=?^_`{|}~] |(?@[a-z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$
Note that this expression assumes case insensitivity options are turned on (RegexOptions.IgnoreCase for .NET). Yeah, that’s a pretty ugly expression.
I wrote a unit test to demonstrate all the cases this test covers. Each row below is an email address and whether it should be valid or not.
[RowTest]
[Row(@"NotAnEmail", false)]
[Row(@"@NotAnEmail", false)]
[Row(@"""test\\blah""@example.com", true)]
[Row(@"""test\blah""@example.com", false)]
[Row("\"test\\\rblah\"@example.com", true)]
[Row("\"test\rblah\"@example.com", false)]
[Row(@"""test\""blah""@example.com", true)]
[Row(@"""test""blah""@example.com", false)]
[Row(@"customer/department@example.com", true)]
[Row(@"$A12345@example.com", true)]
[Row(@"!def!xyz%abc@example.com", true)]
[Row(@"_Yosemite.Sam@example.com", true)]
[Row(@"~@example.com", true)]
[Row(@".wooly@example.com", false)]
[Row(@"wo..oly@example.com", false)]
[Row(@"pootietang.@example.com", false)]
[Row(@".@example.com", false)]
[Row(@"""Austin@Powers""@example.com", true)]
[Row(@"Ima.Fool@example.com", true)]
[Row(@"""Ima.Fool""@example.com", true)]
[Row(@"""Ima Fool""@example.com", true)]
[Row(@"Ima Fool@example.com", false)]
public void EmailTests(string email, bool expected)
{
string pattern = @"^(?!\.)(""([^""\r\\]|\\[""\r\\])*""|"
+ @"([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?<!\.)\.)*)(?<!\.)"
+ @"@[a-z0-9][\w\.-]*[a-z0-9]\.[a-z][a-z\.]*[a-z]$";
Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);
Assert.AreEqual(expected, regex.IsMatch(email)
, "Problem with '" + email + "'. Expected "
+ expected + " but was not that.");
}
Before you call me a completely anal nitpicky numnut (you might be right, but wait anyways), I don’t think this level of detail in email validation is absolutely necessary. Most email providers have stricter rules than are required for email addresses. For example, Yahoo requires that an email start with a letter. There seems to be a standard stricter set of rules most email providers follow, but as far as I can tell it is undocumented.
I think I’ll sign up for an email address like phil.h\@\@ck@haacked.com and start bitching at sites that require emails but don’t let me create an account with this new email address. Ooooooh I’m such a troublemaker.
The lesson here is that it is healthy to challenge your preconceptions and assumptions once in a while and to never let me near an RFC.
UPDATES: Corrected some mistakes I made in reading the RFC. See! Even after reading the RFC I still don’t know what the hell I’m doing! Just goes to show that programmers can’t read. I updated the post to point to RFC 822 as well. The original RFC.
David Meyer recently published a .NET class library that enables duck typing (also sometimes incorrectly described as Latent Typing as Ian Griffiths explains in his campaign to disabuse that notion) for .NET languages.
The term duck typing is popularly explained by the phrase
If it walks like a duck and quacks like a duck, it must be a duck.
For most dynamic languages, this phrase is slightly inaccurate in describing duck typing. To understand why, let’s take a quick look at what duck typing is about.
Duck Typing Explained
Duck typing allows an object to be passed in to a method that expects a certain type even if it doesn’t inherit from that type. All it has to do is support the methods and properties of the expected type in use by the method.
I emphasize that last phrase for a reason. Suppose we have a method that takes in a duck instance, and another method that takes in a rabbit instance. In a dynamically typed language that supports duck typing, I can pass in my object to the first method as long as my object supports the methods and properties of duck in use by that method. Likewise, I can pass my object into the second method as long as it supports the methods and properties of rabbit called by the second method. Is my object a duck or is it a rabbit? Like the above image, it’s neither and it’s both.
In many (if not most) dynamic languages, my object does not have to support all methods and properties of duck to be passed into a method that expects a duck. Same goes for a method that expects a rabbit. It only needs to support the methods and properties of the expected type that are actually called by the method.
The Static Typed Backlash
Naturally, static typing proponents have formed a backlash against dynamic typing, claming that all hell will break loose when you give up static typing. A common reaction (and I paraphrase) to David’s duck typing project goes something like
Give me static types or give me death!
Now I love compiler checking as much as the next guy, but I don’t understand this attitude of completely dismissing a style of programming that so many are fawning over.
Well, actually I do understand...kinda. So many programmers were burned by their days of programming C (among other languages) and its type unsafety which caused many stupid runtime errors that it’s been drilled into their heads that static types are good, just, and the American way.
And for the most part, it’s true, but making this an absolute starts to smell like the monkey cage experiment in that we ignore changes in software languages and tooling that might challenge the original reasons we use static types because we’ve done it this way for so long.
I think Bruce Eckel’s thoughts on challenging preconceived notions surrounding dynamic languages are spot on (emphasis mine).
What I’m trying to get to is that in my experience there’s a balance between the value of strong static typing and the resulting impact that it makes on your productivity. The argument that "strong static is obviously better" is generally made by folks who haven’t had the experience of being dramatically more productive in an alternative language. When you have this experience, you see that the overhead of strong static typing isn’t always beneficial, because sometimes it slows you down enough that it ends up having a big impact on productivity.
The key point here is that static typing doesn’t come without a cost. And that cost has to be weighed on a case by case basis against the benefits of dynamic languages.
C# has used duck typing for a long time
Interestingly enough, certain features of C# already use duck typing. For example, to allow an object to be enumerated via the C# foreach operator, the object only needs to implement a set of methods as Krzystof Cwalina of Microsoft points out in this post...
Provide a public method GetEnumerator that takes no parameters and returns a type that has two members: a) a method MoveNext that takes no parameters and return a Boolean, and b) a property Current with a getter that returns an Object.
You don’t have to implement an interface to make your object enumerable via the foreach operator.
A Very Useful Use Case For When You Might Use Duck Typing
If you’ve followed my blog at all, you know that I’ve gone through all sorts of contortions to try and mock the HttpContext object via the HttpSimulator class. The problem is that I can’t use a mock framework because HttpContext is a sealed class and it doesn’t implement an interface that is useful to me.
Not only that, but the properties of HttpContext I’m interested in (such as Request and Response) are sealed classes (HttpRequest and HttpResponse respectively). This makes it awful challenging to mock these objects for testing. More importantly, it makes it hard to switch to a different type of context should I want to reuse a class in a different context such as the command line. Code that uses these classes have a strong dependency on these classes and I’d prefer looser coupling to the System.Web assembly.
The common approach to breaking this dependency is to create your own IContext interface and then create another class that implements that interface and essentially forwards method calls to an internal private instance of the actual HttpContext. This is effectively a combination of the composition and adapter pattern.
The problem for me is this is a lot more code to maintain just to get around the constraints caused by static typing. Is all this additional code worth the headache?
With the .NET Duck Typing class, I can reduce the code by a bit. Here’s some code that demonstrates. First I create interfaces with the properties I’m interested. In order to keep this sample short, I’m choosing two interfaces each with one property..
public interface IHttpContext
{
IHttpRequest Request { get;}
}
public interface IHttpRequest
{
Uri Url { get;}
}
Now suppose my code had a method that expects an HttpContext to be passed in, thus tightly coupling our code to HttpContext. We can break that dependency by changing that method to take in an instance of the interface we created, IHttpContext, instead.
public void MyMethod(IHttpContext context)
{
Console.WriteLine(context.Request.Url);
}
The caller of MyMethod can now pass in the real HttpContext to this method like so...
IHttpContext context = DuckTyping.Cast<IHttpContext>(HttpContext.Current);
MyMethod(context);
What’s great about this is that the code that contains the MyMethod method is no longer tightly coupled to the System.Web code and does not need to reference that assembly. Also, I didn’t have to write a class that implements the IHttpContext interface and wraps and forwards calls to the private HttpContext instance, saving me a lot of typing (no pun intended).
Should I decide at a later point to pass in a custom implementation of IHttpContext rather than the one in System.Web, I now have that option.
Yet another benefit is that I can now test MyMethod using a mock framework such as RhinoMocks like so...
MockRepository mocks = new MockRepository();
IHttpContext mockContext;
using (mocks.Record())
{
mockContext = mocks.DynamicMock<IHttpContext>();
IHttpRequest request = mocks.DynamicMock<IHttpRequest>();
SetupResult.For(mockContext.Request).Return(request);
SetupResult.For(request.Url).Return(new Uri("http://haacked.com/"));
}
using (mocks.Playback())
{
MyMethod(mockContext);
}
You might wonder if I can go the opposite direction. Can I write my own version of HttpContext and using duck typing cast it to HttpContext? I tried that and it didn’t work. I believe that’s because HttpContext is a sealed class and I think the Duck Typing Project generates a dynamic proxy that inherits from the type you pass in. Since we can’t inherit from a sealed class, we can’t simply cast a compatible type to HttpContext. The above examples work because we’re duck type casting to an interface.
With C#, if you need a class you’re writing to act like both a duck and a rabbit, it makes sense to implement those interfaces. But sometimes you need a class you didn’t write and cannot change (such as the Base Class Libraries) to act like a duck. In that case, this duck typing framework is a useful tool in your toolbox.
UPDATE: Using Coral CDN to serve up my images and stylesheets ended up being a mistake and actually slowed down my site. I’d recommend using Amazon S3 instead if you need high bandwidth fast serving of static content. Coral CDN is probably better for cases when you want to serve up a large file (mp3, mpeg, etc...) and save on your bandwidth usage. It doesn't seem ready to be a general purpose CDN for speeding up your site. I’ll add the ability to this code to use S3. In the meanwhile, this code is still useful by simply restricting the extensions in the config file to perhaps this list "mpg,mp3,mpeg,wmv,avi,zip". Hat tip to Jon Galloway for pointing that out.
Yahoo recently released the ever so popular YSlow add-on for Firebug used to help locate bottlenecks for web pages. From their developer network site we learn...
YSlow analyzes web pages and tells you why they’re slow based on the rules for high performance web sites. YSlow is a Firefox add-on integrated with the popular Firebug web development tool. YSlow gives you:
* Performance report card
* HTTP/HTML summary
* List of components in the page
* Tools including JSLint
YSlow provides a nice report card for your site. Here you can see the unfortunate grade my blog gets at the time of this writing.
Naturally I couldn’t just sit there while some unknown Yahoo disdainfully gives my blog an F. I decided to start digging into it and start attacking specific items.
I decided to start with #2 Use a CDN which stands for Content Distribution Network. The Yahoo YSlow help page has this to say about CDNs.
A content delivery network (CDN) is a collection of web servers distributed across multiple locations to deliver content more efficiently to users. The server selected for delivering content to a specific user is typically based on a measure of network proximity. For example, the server with the fewest network hops or the server with the quickest response time is chosen.
That certainly sounds useful, but the CDNs listed by Yahoo include Akamai, Mirror Image Internet, and LimeLight Networks. These might be great for big companies like Yahoo, but they’re a bit cost prohibitive for small fries like us bloggers.
Coral to the Rescue
That’s when I remembered the Coral Content Distribution Network. Jon Galloway wrote about this a long time ago as a means to save on bandwidth. The one fatal flaw at the time was that the network only worked over port 8090. Fortunately, that little issue has been corrected and Coral now works over port 80.
And the wonderful thing about Coral is that it’s trivially easy to use it. All you have to do is append your domain name with .
So this:
http://example.com/my/really/big/file.mpeg
becomes
http://example.com.nyud.net/my/really/big/file.mpeg
And now your really big file is being served up by hundreds of geographically distributed servers. You just need to keep that file on your server at the original location so Coral can find it when adding it to its network.
Tell YSlow about Coral
By default, YSlow doesn’t recognize Coral as a CDN, which means implementing Coral CDN won’t affect your YSlow grade. YSlow only recognizes the CDNs in use by Yahoo. Fortunately, it’s pretty easy to add Coral to the list. Just follow these steps:
- Go to
about:config in Firefox. You’ll see the current list of preferences.
- Right-click in the window and choose New and String to create a new string preference.
- Enter
extensions.firebug.yslow.cdnHostnames for the preference name.
- For the string value, enter the hostname of your CDN, for example,
nyud.net. Do not use quotes. If you have multiple CDN hostnames, separate them with commas.
Here’s a screenshot of the domains I added to YSlow. I’m sure I’ll think of more to add later.
How can I automate this?
You knew I wasn’t going to write about this without providing some means for automating this conversion, did ya? There are two approaches I could take:
- Rewrite URLs to static files on incoming posts.
- Rewrite URLs on the way out.
The first approach rewrites the URL as you are posting content to your blog. This has the distinct disadvantage that should you decide to change the distribution network, you need to go through and rewrite those URLs.
The second approach rewrites the URLs as they are being output as part of the the HTTP response. The issue there is to do it properly requires buffering up the entire output (rather than letting IIS and ASP.NET stream it) so you can perform your regex replacements and whatnot. This can impair performance on a large page.
I decided to go with option #1 for now for performance reasons, though option #2 would be quite easy to implement. I wrote an HttpModule in the same style as my Windows Live Writer crap cleaner which rewrites an incoming MetaWeblog API post to append nyud.net to the domain.
The code here only works with Windows Live Writer and BlogJet (untested in the latter case) but can be easily modified to allow posts for any blog client (I just got lazy here) by modifying the user agent within the method IsMetaweblogAPIPost.
The reason I didn’t write this as a WLW plugin is that it’s not yet possible to hook into pipeline and rewrite content just before WLW posts it to the blog. That may be coming in the future though, according to this comment by Joe Cheng of the WLW team.
Download and Use It
You can download the code here (binaries are included in the bin dir) in a project called HtmlScrubber. I simply added this HttpModule to the same code as the WLW Crap Cleaner module mentioned earlier. To use it simply add the following to your web.config.
<httpModules>
<add type="HtmlScrubber.CoralCDNModule, HtmlScrubber"
name="CoralCDNModule" />
</httpModules>
This filter works by looking at the file extension of a referenced file. If you’d like to change the list of extensions, you can add the following configuration.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="CoralCDNConfigSection"
type="HtmlScrubber.CoralCDNConfigSection, HtmlScrubber"
allowDefinition="Everywhere"
allowLocation="true" />
</configSections>
<CoralCDNConfigSection
extensions="mpg,mp3,mpeg,wmv,avi,zip" />
</configuration>
The list of extensions shown are the default, so you don’t need to add this configuration section unless you want to change that list. Please enjoy and let me know if you put this to good use. Hope this makes your blog faster than mine.
As for me, I’m moving on to looking into using JSMin, JSLint, and merging CSS files etc...
Joe Cheng, member of the Windows Live Writer team, just unveiled his first publicly available Windows Live Writer plugin...
I’ve just released my first (publicly available) Windows Live Writer plugin: Dynamic Template. It lets you write mini-plugins from snippets of C# and HTML, and reuse them within Windows Live Writer.
It’s sort of a meta-plugin plugin. He has a screencast on how to use it, but I’ll post a few screenshots of it in action here.
The plugin adds a new Insert Template option in the sidebar.
Clicking on this brings up a dialog with a list of templates.
Click New to bring up the template editor. I’m going to create one for wrapping sections of html with the <code></code> tags.
First, I’ll name the template.

Then I’ll edit the template. Since this template just adds HTML around a selection and doesn’t require that I ask for user input, I don’t need to create a variable.
And now I can just select some text, click on Insert Template... and double click Code. Nice!
Another useful template is one that Joe calls Htmlize.
As you can see, you can call some functions from within a template. This one is useful for converting something like <sup>blah</sup> into blah while in the Web Layout or Normal mode.
Watch Joe’s Screencast for a demo of a template that takes in user input as part of the template. There’s also some documentation located here. This is a pretty handy plugin that’ll be great for automating a variety of html snippets I use often.
Run, don’t walk, over to .NET Rocks and download their interview with yours truly (as in me, not any other yours truly).
I had a real blast chatting with Carl Franklin and Richard Campbell. We covered all my favorite topics (well except soccer) which include Software Development, Open Source, and Subtext!
I’m still here in Redmond on the Microsoft campus so I haven’t had the cringeworthy experience of listening to myself talk. ;)
Technorati tags:
.NET Rocks,
Subtext
A coworker of mine ran into some problems using WATIN to test our website. Specifically issues with Javascript and AJAX. Yes, I know there’s Selenium out there, but I hoped for something we could run from within NUnit/MbUnit, so that it’s nicely and easily integrated into our build process and development environment.
He did a bit of digging and found this free web automation infrastructure product by Art Of Test Inc. called WebAii (they also have a blog). It seems to do everything we want and more. Check out some of these features (the full feature list is much longer).
- Supports IE and Firefox
- Supports DOM actions and pure UI Mouse/Keyboard actions for Ajax Testing
- For ASP.NET testing, you can use an In-Process Host for fast browser-less testing without a webserver
- Use ASP.NET Development Server (aka Cassini) to run tests without IIS
- Use name, id, xpath identifications. (Need to see if they support Regex too)
- Unit test your JavaScript by calling JS methods from your .NET code.
- Extensions for NUnit and VS Team Test (I’ll ping them to build one for MbUnit)
These are just a small sampling of the many features. It sounds like this would be a killer web testing app. Does anyone have experience with it?
We’re going to evaluate it and I’ll keep you posted, but I thought I’d mention it here because it sounds great.
Features I’d Like To See In A Web Unit Testing Tool
- Ability to set the UserAgent and Referrer
- Ability to set request headers
- Ability to hook into and verify the status of a redirect. For example, if a page redirects, I want to be able to assert that the HTTP Status code for the redirect
I mentioned I’ll be at the Microsoft campus next week. Scott Koon (aka LazyCoder) pinged me about meeting up for a drinky drink and geeky geek conversation and Sunday works best for him.
Anyone have a good recommendation for a place to get a good drink in or near Redmond? Perhaps BillG’s hidden stash on campus? Anybody want to join us? I think 10 or 10:30 PM works for me.
It’s standard procedure for me to roll into the morning session of a conference completely sleep deprived and trashed from the previous night’s celebrations. It just wouldn’t be right to not continue that tradition.
I’m also free Monday night as far as I know.