« March 2007 | Main | June 2007 »

April 11, 2007

Standalone cross-domain XHR interface

Does anyone know of a simple, standalone cross-domain XHR interface that allows for the ability to swap between a real XHR implementation and a cross-domain, iframes-based implementation?

I know Dojo and DWR, among others, have them, but they are all part of a larger framework. Because this is going to be used with Selenium, which needs to avoid polluting common popular JS namespaces, I'd prefer to find something that is standalone.

I'm very surprised one doesn't pop up when I search google.

April 10, 2007

Jive Forums 5.5: A quick review

I recently upgraded the OpenQA forums over to Jive Forums 5.5 (beta) and I am very impressed. We were using a pretty old version (4.2.1) and the difference was like night and day.

The upgrade

The upgrade was as simple as it can get

  1. Copy the new war file over the old one.
  2. Open the forums in the browser.
  3. Enter the administrators password to initiate the upgrade process.
  4. See a nice little list of steps that need to be completed, along with estimated times for each task.
  5. Done.

It really was that easy. Everyone should build software this good. The only other company I know that has a nice upgrade framework is Atlassian, and theirs is nowhere as elegant, nor does it provide the visual feedback that inspires confidence in a process that inherently introduces risk.

Reply by watches

By far my favorite new feature. Previously, the OpenQA forums have been using Jive's unique "email gateway" feature that allowed a mailing list and a forum to stay in sync. This let users choose the style of message delivery (web, RSS, forum watch email, mailing list membership, etc).

I chose RSS+web because I get enough email as is and hate being subscribed to random lists that I can't remember how to jump off of. Plus, I like knowing that my membership is part of the forums, which gets you little things like "reward points" for answering questions (something which obviously email doesn't have).

But whenever I traveled, I missed email. I wanted to be able to reply to the threads I saw in my RSS reader while offline in an airplane, but I couldn't. In the latest version of forums, Jive introduced a killer new feature: reply to watches by email.

Now I can watch my feeds in RSS, but when I know I'll be on the road coming up, I can turn on my email watches to the forum. Then, as each message comes in, I can reply to the watch notification itself and my response will automatically show up in the forums (and get sent out to the mailing lists, thanks to the gateway we're using). To me, this is the best of both worlds, and Jive did an excellent job with it.

My only complaint is that the subject the watches come in with is unique every time. This is due to how they sync up replies with threads. The downside of this is that my watch notifications won't get grouped together as a thread in my mail client, so it's a bit harder to follow conversations. I also had to modify the watch templates to include the entire thread instead of just the new message. This gives the required context that one would expect if they wanted to reply by email.

Wiki formatting

The new forums also allow for common formatting, often found in wikis, to be used in forum posts. This is nice because now I can format new replies by email and I know it'll look good for both audiences: text (email) and HTML (web and RSS).

But what I was really impressed with was the customizations. Jive supports a link syntax similar to Confluence (Atlassian's wiki) that uses square brackets. Unfortunately, the OpenQA forums use square brackets a lot due to the fact that people post xpath expressions all the time, such as

//div[contains(@id, 'border-box')]

This, of course, produced some bogus links. What impressed me is that I could drill in to the wiki formatting settings and individually turn off link support. Even more: when I turned it off, it no longer appeared in the help guide! That's the way software should work all the time.

Other stuff

THe OpenSymphony Forums have had integrated web chat support for a while, written by yours truly. However, the OpenQA ones never did because I didn't want to maintain the code going forward. While it isn't quite as nice as the OpenSymphony forums, Jive Forums now comes with an integrated web-based group chat. This is a great way to host meetings and to help people out in real time.

The features I'm missing from the OpenSymphony forums are:

  • Ability for chat transcripts to be easily searchable and accessible. I did this by posting the chat log to the forums every 24 hours, but other solutions are possible too
  • When in the forums, being notified that activity is happening in the forums (new message posted). I did this with a "chatbot" in the OS forums, but again, this could be done other ways, such as XMPP watches, etc.
  • Tying chat rooms and forums together such that the people in the associated chat room are listed along side the forum as "now chatting". Even better, their expertise level (reward points) are shown, so people can immediately tell if experts are ready to help them in real time.

The good news is that a lot of this stuff will likely end up in some sort of integration between Openfire and Clearspace (think of it as Forums + blogs + wiki + content management + etc).

Overall, Forums 5.5 was a great improvement. I'm looking forward to Clearspace, when hopefully my little nit-picks will be addressed :)

April 09, 2007

Atlassian outlines how to build great software

All software development organizations, take notice: Atlassian builds software right and the result is continually great software. I can't speak for Crowd (haven't used it), but I certainly know that the process defined in this article certainly will put your project on the path for success (in terms of technology... of course if the idea sucks, a nice dev process won't save you!):

Basically we have taken the following steps:

  1. Move from CVS to SVN
  2. Move from Ant to Maven 2
  3. Add some level of test coverage, and build this into our development process
  4. Add integration tests for the Crowd Console
  5. Hook all this up with Cargo and Maven 2
  6. Drop it into a continuous integration server

(Via Atlassian Developer Blog.)

The only thing I think they could improve on is the use of JWebUnit/HtmlUnit. They should really step up to Selenium, especially considering how often bugs crop up due to inconsistencies across web browsers. But still, that is merely an incremental improvement to their very solid foundationl. On top of that, JWebUnit has an abstraction layer on top of Selenium, so it should be an easy switch.

Apache Struts 2 from Square One

Great work from Ted Husted...

Apache Struts 2 from Square One:

Ted Husted has put together an impressive training course together for Struts 2 called Apache Struts 2 from Square One. He's released an initial version of the 127-page PDF on SourceForge.
w
p. (Via Raible Designs ~ We Build Web Apps.)

April 03, 2007

Next gen testing tools: infrastructure

About a month ago I wrote that I thought the two most important things tomorrow's testing tools need to help with are infrastructure and maintenance. I'm about a month late on my promised follow up, but I suppose it's better late than never.

What I wrote was:

By infrastructure, I mean challenges like setting up the test environment, keeping it in a consistent state, ensuring you have all the tools/browsers/databases/whatever always available for automation, running your tests in a timely manner, etc. All of these are much more challenging that JUnit, simply because JUnit only concerned itself with in-memory state and fixtures that could be recreated in milliseconds, not minutes or hours.

As applications become more complex, the work required to automate functional testing also becomes more complex - often more complex than the application itself. For example: it's trivial these days to do Web 2.0 "mash ups" in your app and embed a Google Map in to your page (it's a simple <script> block).

But what about testing that functionality? What about checking the performance of it? Not only does it require a compatible browser (no more HttpUnit or HtmlUnit, now you need to use something like Watir or Selenium). And what if you want to test what your app behaves like when the Google Map service is down or running slow. How do you do that?

The fact is that as we continue to build layers and layers of abstraction and extensible services, our speed at which we can develop rich, complex applications grows and the ability to test those applications becomes a much harder challenge.

Next gen tools must help

This is why I believe that the most fundamental thing that any testing tool (or process) will do in the coming years is to help manage these complexities. It's not an easy problem to solve, but fortunately some ancillary technologies such as virtualization help immensely.

The testing tools of tomorrow can no longer simply assume that automation of the test case (click there, type this, click here, type that, ...) is enough. We are in an age where that type of technology is a commodity (Selenium, Watir, etc). They must take developers to the next level of automation and help automate the process of preparing to run these scripts.

Many QA teams spend a majority of their time not writing automated tests or performing required manual testing, but in fact setting up the application in a QA/testing environment. This is a huge waste of time and is something that is begging to be automated.

Continuous integration is key

Let's pretend tomorrow's tools do this. They now automatically set up your database to a know state. They help you manage snapshots of data that can be used for various automated tests. They reset the state as needed when running automated test cases. They deploy your application properly. They set up a web browser with the cache cleared out. They do it all.

The logical next step is continuous integration. The vision outlined in Martin Fowlers essay can be realized for not just code that can be easily unit tested, but for all the code in your application, even HTML, JavaScript, Flash, etc.

Now when you check in your latest JavaScript changes, you don't have to worry about nagging questions like, "I forget, does IE support hasAttribute()?" (it doesn't). Now all the benefits you got for writing unit tests (instant feedback on failures, etc) can be realized for writing functional tests.

Suddenly there is a huge incentive for getting developers to take part in the process of writing functional tests in addition to the unit tests they write. That's because they are continually reminded of those tests, every time they check in code they are notified if one of those tests fails.

Contrast this to today, where most teams barely even write functional tests, and those that do usually relegate that job to the QA team to run near the end of the release cycle. The difference is like night and day.

Some are doing it today...

The good news is that some people are already doing this. Projects like HSQL (an in-memory database) and Cargo (automatic J2EE deployment tools) help considerably. I recently "blogged":... about how Atlassian is using these tools to get close to tomorrow's development and testing process today.

HSQL and other in-memory databases help here because they allow for your functional tests to have clean fixtures. That is: they provide a simple and quick way to reset the data in your application so you can run the next functional test. And because they are in-memory, you can reset the state for every test, ensuring you get zero conflicts between test X and test Y.

Cargo is another great tool because it does all the heavy lifting required to deploy a J2EE application to a specific app server (Tomcat, Resin, JBoss, etc) and even allows you to programatically configure it, such as define database connection pools. In fact, Cargo recently began to add support for deployment and configuration of databases as well, so you could use it to set up your entire application deployment just before you run a test.

... but soon they will need more

While HSQL and Cargo are nice, they still are merely emulations of the real thing. That is, you likely won't use HSQL in production and you likely won't deploy on the same configuration of Tomcat that Cargo provides. Just as jWebUnit served as an acceptable browser emulator until AJAX arrived, these projects too do their job well for the time being.

However, as deployments become more complicated, so too will we again need to test on the real thing. So just as Selenium is to jWebUnit, tomorrow's testing tools will need to provide an ability for technologies like HSQL and Cargo.

For example, just last week I had first hand experience with this challenge. Our functional tests use HSQL, but our production environment runs on Postgres. I had checked in some new code that executed a query that was passing just fine in our continuous integration process, but when it came time to push to staging, it broke.

The truth is that in a perfect world, we should be testing on the same environment as our production one, and things like HSQL just don't cut the mustard. The reason we use them, however, is pure pragmatism: it costs too much and takes too long to develop a testing environment/functional testing fixture that works with a clone of your production environment.

Rising infrastructure costs

In fact, even those that are doing this today run in to challenges: Atlassian's full integration test suite takes hours to run. Some teams have reported to me that their suites take over a day to complete. And this is all while using shortcuts in their fixtures such as HSQL.

This is where parallelization comes in. The reason these test suites take so long is that they almost always run in sequence. That is: test X runs, then test Y runs, etc. To save time, some teams cut out the heavy lifting in their fixtures (such as deploying the application, setting up the DB, etc) to only happen at the start of the suite rather than each test.

This almost always leads to tests that end up conflicting with other tests (ie: test X and test Y both try to create the same user with a unique username of "bob"). But on top of that, it also begins to introduce dependencies between tests and a preference towards test ordering.

That's because, after a while, developers begin to take advance of this sequential order and do even more nefarious shorts. No longer does test Y need to create a new "Widget ABC", because test X did. Of course, if test X ever changes, test Y suffers for it.

So why do even the best teams do this? Because there really isn't another option today. That's because the cost in terms of hardware/infrastructure as well as developer time are orders of magnitude larger.

If you currently have 500 functional tests and it takes, on average, 10 seconds per test, plus a one-time 5 minute fixture setup time, then you can run all your tests in about 90 minutes. But if you reset your fixture for each test, it would take 43 hours. Pragmatism takes hold usually right when people realize this.

Even at the much smaller 90 minutes, it's often too long to place in to a continuous integration process that runs on every commit. The solution is parallelization. Now image those 500 tests running in parallel. The entire suite could run in 5 minutes and 10 seconds - or a short enough time that you could introduce a complete, reliable, real functional test suite that runs as often as you need.

The limitation today is the hardware costs: 500 build machines would cost a team $1,000,000, plus multiple times more maintaining it, powering it, etc. It's just not possible... today.

The next gen testing tool isn't a tool at all

Assuming that a "next gen testing tool" must be something that radically improves the software development process, it is my belief that tomorrow's next gen testing tool will in fact not just be a tool, but an entire infrastructure, most likely offered as a service that you can rent on an as-needed basis.

It would let you run your 500 functional tests in as many as 500 parallel tasks, or as little as 1. It would let you ramp up the parallel tests as your needs and budget evolve. It would finally allow you to run all your tests after every commit, giving you the maximum level of confidence after each commit.

... and it might even be called HostedQA ;)

April 02, 2007

IDEA Really is That Good

Saw this post, titled IntelliJ IDEA Just Works, the other day:

Sebastiano Pilla wrote a very interesting article about his experiences with the top four IDEs. After testing each one according to his criteria, his pick was IntelliJ IDEA:

    “IDEA simply worked without getting in my way with arbitrary limitations. Where it shines is in the editor, the configurability and the speed at which everything operates: in a “shopping list” of features it might lose to the others, but it wins because the implementation and the design feel more consistent to me.”

The lesson is clear. Comparing IDEs by simple feature lists won’t necessarily find you the best IDE. You need to actually try it to be sure it will be right for you. Look for an IDE that boosts your productivity by doing what you expect it to do without getting in the way, i.e. it ‘just works’. A feature list might tell you a feature is there, but it won’t tell you how well it works.

(Via http://blogs.jetbrains.com/idea/feed/atom/.)

At my new place of employment (more on that soon), just about everyone uses Eclipse. As someone who has used Eclipse both in the past and more recently, I consistently find myself trying to explain why IDEA is so good.

This is my attempt to explain my favorite "features". I say "features" because many of these aren't the type of bullet-point features you might see in a direct comparison (ie: "EJB3 Support", etc), but rather little nuggets that really do make the difference and make me more productive:

Way smarter code complete

Can go beyond the basic support provided by eclipse and can even narrow the completion down to only objects that are type-safe. That is: it won't show you a variable that, if selected, would result in a compile error.

Camel case understanding

When finding classes, doing code complete, or just about anything else, IDEA understands that when you type "fUM" you really mean "fanstasticUserManager". It's a nice touch that saves a lot of typing.

Smart inspections

People who write code in IDEA often write code that is not as clean, and that is due to IDEA's built in smart inspections. It can do things like highlight when an "if" statement can be simplified, or when a null check will always be true.

Easy to act on

Once one of these warning or error inspections pop up, IDEA makes it trivial to take action on it and fix it. Got a missing import? Alt-Enter. Have a redundant if statement? Alt-Enter. See an unused parameter? Alt-Enter. Usually IDEA will give you a few options, such as removing the offending code, changing it, or even suppressing the warning for the statement, method, class, project, or globally.

It knows what you mean

IDEA is smart. It keeps track of how I name my variables and learns over time. At first, if I am creating a new variable of type BananaSundae, it'll recommend bananaSundae, sundae, and banana, in that order. But, over time, if I keep naming my BananaSundaes simply "ba", it'll start prompting that.

Best HTML editor in the world

This is not an understatement. Ruby-fanatics even admit their beloved TextMate has nothing on IDEA (right Dion?). Heck, at my company, our VP of Marketing (who gets hands-on w/ web design) now uses IDEA and swears by it. Why? Because it speaks fluent CSS, HTML, and JavaScript. And all those nice inspections work here too. It'll highlight unused CSS declarations. It'll help you find usages for JS functions and CSS classes. It'll even point out the fact that "0px" is redundant and can simply be "0"... and you don't have to delete "px"... remember, just press Alt-Enter!

More

I could go on and on, but this list would literally end up being numbered in the hundreds. The point is: IDEA really does do a ton of small things that make programming faster, easier, cleaner, and less error-prone. I can't tell you how many times I open up code written in Eclipse and immediately see lots of yellow dashes where the code could be cleaner (ie: e.printStackTrace uses, redundant code, synchronized blocks on non-final variables, etc).

And most importantly, it never gets in the way. In fact, it even makes it easy to tell it not to get in the way: if there is an inspection you just don't want to see anymore, Alt-Enter and there is an option right there to turn it off forever.

I'll part with this little nugget: the other day I was tracking down a reported bug that the screencapture capability of HostedQA was cropping incorrectly. I opened up the relevant class and IDEA immediately showed me the problem:

smart_idea.png

Can your Eclipse do that?