SpamapS.org – Full Frontal Nerdity

Clint Byrum's Personal Stuff

Have you measured something lately?

cred
I think we all come upon situations where we can do something the simple way, maybe at the cost of efficiency, or the most efficient way, but it won’t be clear and easy to repeat or maintain long term. In software this is especially true because of the flexible nature of what we’re doing, but it happens in all walks of life.

You can take the freeway, and that is usually the fastest way between points. But anybody who has live in Los Angeles knows that sometimes the freeway is more like the parkway, as in, a parking lot full of cars going < 5mph. Just 100 yards to either side of this molasses like river of metal and rubber, there are surface streets whose average speeds are in the 20-30 mph range, even including stop signs and lights.

In the past, we would just take the freeway anyway. Who knows what lies on those streets? Pick the wrong one in LA and you’ll get a nice up close view of the spot where Reginald Denny was met by an angry mob back in the 90′s. Pick the right one and you will probably get to your destination a few minutes earlier and with a lot less feeling of helplessness and stress.

However, today we have some measurements available to us, and can make informed decisions. These days, before I go to drive anywhere, I pop up google maps. I instantly have some actual, reasonably accurate numbers, for where the parking lots and auto-bahn like areas of the freeways are. If I haven’t been on one of the streets, I drop my favorite little traffic helper on the spot, as I call him “street view man”, and get an idea for who I might encounter whilst enjoying the adventure of touring a new neighborhood.

When writing software, do you have similar measurements available to you? Why not? Is it too hard? Not valuable enough? How much is your time worth? How much is the program’s execution time costing you, or your clients?

Measure something today. Its fun, and graph porn is the best way to brag.

May 31, 2011 at 7:03 pm Comments (0)

Bromine and Selenium – second and third most useful elements behind Oxygen

If you’re an engineer, you hate testing. Seriously, who likes doing what those mere mortal “users” do? We’re POWER users and we don’t need to use all those silly features on all those sites. Just look at Craigslist, clearly an engineer’s dream tool.

For web apps, testing actually isn’t *that* hard. The client program (the browser) is readily available on every platform known to man, and they generally don’t do much more than store and retrieve data in clever ways. So, its not like we have to fire up a Large Hadron Collider to observe the effects of our web app.periodictable

Therein lies the problem though, as clicking around on web forms and entering the same email address, password, address, phone number, etc. etc., 100 times, is BORING.

Enter Selenium. This amazing little tool has been on the scene for a little while now, but its just now getting some momentum. Click through to the website and watch “the magic” as they put it, but basically here’s how it goes:

  • open their firefox plugin and click ‘record
  • do something
  • click ‘record’ again.

Then just save this little test case to a file, and the next time you change anything that might relate to the series of clicks and data entries you just made, run this test again. There are all kinds of assertions you can make while you’re doing something. Like ‘Make sure the title is X’ or ‘make sure a link to Y exists’.

But wait, I could have done that with something like Test::More,  PHPUnit, or lime. Where’s the real benefit?

Well because Selenium remotely controls your browser, all those gotchya’s regarding javascript CSS incompatibilities can come into play here. Because Selenium can control Internet Explorer, Firefox, *and* Safari. In fact it can also control Opera, and according to their website, any browser that properly supports javascript fully.

This is really a nice evolutionary step for web shops, as tools like this generally are OS specific and cost a lot of money. Once again open source software appears where a need becomes somewhat ubiquitous.

You can even take it a step further. The next thing that generally happens in a web dev shop when they get bigger than 20 or 30 people is they hire people who actually like testing. Well not really, but they dislike it *less* than software engineers. These are QA engineers. And they DO like things to be orderly and efficient.

Bromine is the answer for that. Its still pretty rough around the edges, but it gets the job done.

Again check out their website and watch the screencast, but basically it goes like this:

  • Write selenium tests as specified above
  • Upload tests to Bromine server
  • Attach tests to requirements
  • Run selenium remote control on all required OS/browser version combinations (can you say virtualbox?)
  • Run tests

Another nice thing about using bromine is now you are running your tests in a server side language, not just the Selenium IDE, which is limited to the IDE’s generated “Selenese” XML commands for tests. The IDE exports your basic test into PHP or Java, and then on the bromine server you can do interesting things, like check an IMAP box for an email, run a backend process, or send an SMS.

At first it may not seem like much, but eventually you end up with a multitude of useful tests for your web app that can be run all the time against development branches before release, and catch many problems. Quality means happier users, which hopefully means loyal users that keep coming back.


November 3, 2009 at 1:48 am Comments (0)