Friday, October 26, 2007, 05:01 PM - Web
We have had a couple weeks discovering interesting problems in Javascript, and one that I had been seeing for a long time but finally had a chance to dig into a couple weeks ago before the Windmill 2.0 release was a problem in Safari 2 with Math.random().This first showed it's gnarly teeth in an algorithm I had written to generate a random user every time you ran a test suite, so I didn't have to think about conflicting users and I didn't want to remove the user at the end of every test run because it is important for us to grow that database and see how it performs.
Here's the code that enabled the problem:
var getRandomKey = function () {
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';
var len = 16;
var str = '';
for (var i = 0; i < len; i++) {
var rnum = Math.floor(Math.random() * chars.length);
str += chars.substring(rnum, rnum + 1);
}
return str;
};
(excerpt from fleegix_js/trunk/plugins/hash.js)
This worked great on every browser except Safari, where I had to delete my user from the last session every time I ran the test suite. The Math.random() in Safari uses the same starting point and same algorithm to generate the random number used, so that each time you start your browser and generate a Math.random() you get the same value, not very random is it?
Our solution to this problem is demonstrated below, you make want to tweak it even more dependent on your requirements.
var getRandomKey = function () {
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';
var len = 16;
var str = '';
var mls = new Date().getTime();
for (var i = 0; i < len; i++) {
// In Safari 2 Math.random returns the same random
// sequence after firing up the browser -- return
// something randomish
if (navigator.userAgent.indexOf('Safari/41') > -1) {
rnum = (((mls / (i + 1)) + mls) % chars.length);
}
else {
var rnum = (Math.random() * chars.length);
}
rnum = Math.floor(rnum);
str += chars.substring(rnum, rnum + 1);
}
return str;
};
My original fix was to simply rip a piece of Date().getTime() and append it to the string in Safari, but mde's implementation above is a bit more elegant and generates a string of the same length for every browser.
A week later we were investigating a bug in the Cosmo UI breaking intermittently in Safari which finally brought us right back to this bug. Over time Safari users were generating event's in the DB and the code to do this obviously used Math.random() as part of the algorithm to generate the event's ID, as these were propagated to the DOM when building the UI to display these events we wound up with multiple events with the same ID which caused some serious problems.
Hope this helps someone out there with their terrible Safari bug they haven't figured out yet!




( 3 / 270 )
Wednesday, October 17, 2007, 03:31 PM - QA
Yesterday we pushed out the 0.2 release of Windmill to the eagerly awaiting world of QA. (If you want it installing while you read on, 'easy_install windmill')For those of you who aren’t familiar with Windmill, it is a framework we have built at OSAF for automating tests against our Web Calendar User Interface. In other words, it’s a slick way to save yourself some time by creating tests that will insure the quality of your web page as you are developing them. We at OSAF have some very advanced needs for the project, so the more you use it, the more you will discover all of the other features that make it as impressive as it is.
A few months ago Windmill became an official OSAF project and has been gaining steam every since. After a long period of working out glaring adoption blockers we came out of stealth mode to present at OSCON in Portland and are now actively building our community.
We have made the setup process as easy and well documented as we possibly can, and encourage anyone interested to install windmill and give it a try. We do our very best to respond to all outside feedback, and make ourselves available in the IRC channel (#windmill on Freenode) to solve all your Windmill issues. OSAF takes openness in it's projects very seriously and we are committed to making the project easy for you to get involved, and encourage outside contributors and feedback.
This release includes many new features and bug fixes:
- Windmill Unit Tests, for all your future contributors out there to make sure you didn't break anything!
- Browser launcher support for Safari and Firefox Linux, no more manual proxy configuration.
- Lots of performance and stability improvement, say goodbye to those t-box hangs.
- The assertion explorer tool, now point and click to create your assertions.
- Javascript tests, write tests in Javascript to test deep down in that app's source.
- Commenting in all of the test files, including JSON.
- Windmill support for testing against localhost
- Fully functional WIndmill Integrated Development Environment in all the browsers.
- Controller additions of many wait and assert functions, get better control of your tests.
- Convenience features including automatically giving you the correct focus when working in the IDE, smarter logic in the DOM Explorer.
- DOM serialization, you can now pause your tests and get the state of your page on command.
- Cross domain, frame and window recording and testing
- And much more...
Any documentation you may need is available at our website, http://windmill.osafoundation.org and if you find any areas that could use improvement we encourage you to signup and add to the WIKI.
Other documents you may want to jump to:
- Windmill Mailing List
- The Windmill Book Index
- Installing Windmill
- Logged tickets
- Source Repository
Monday, October 15, 2007, 02:22 AM - QA
Last Thursday Mikeal, Dan and I made our way down to Google to do a Windmill presentation for the Python fanatics as well as anyone else interested in what we were doing (BayPiggies is a Python Users Group in the Bay Area). We found at OSCON that any presentation with the word AJAX in it seems to attract more people than you would expect.. hopefully many of them had an interest in Web UI testing, Python, Javascript or just really cool calendaring software. I wore my OSAF t-shirt to open the gateway for as much evangelizing as I possibly could. The presentation started at 7:30, was done at about 8:30 and we were busy conversing until around 10:30. Apparently there was enough interest to keep us yacking with people for two hours.
Tomorrow we will be posting the presentation slides, which were a doctored and updated version of our OSCON presentation. Additionally tomorrow lunch will be the deciding point on whether we can release Windmill 0.2 without feeling too fearful about glaring bugs. In a relatively comedic and usual fashion, I was making checkins up until the second before the presentation actually started. Unfortunately one of the problems I thought I had fixed still did show up in the presentation.. fortunately it was relatively unimportant. Of course Friday morning I got a much more solid fix in, so we should be all set for any further presentations. As we have had a lot of interest in San Francisco from people who aren't so keen on a drive down to the South Bay and back, we will probably work out a way to do a presentation up here.. so keep your eyes on the mailing list of you are interested in that.
Part of our audience included Jason Huggins the now Google employed creator of Selenium which was started to reach many similar goals to that of Windmill, and has gained a very large community. Selenium was part of the inspiration for Windmill and if you browse our source you will see snips of Javascript here and there where I either used pieces of their code base, or concepts based on things I saw in their code base. One of the things that was pioneered by Selenium was this concept that not only can you fire an event attached to a DOM element on the page, but you can also simulate this without a user by pretending to be a user, or artificially firing these events. This simple concept has lead to a world of Web UI automation and is growing huge amounts everyday.
After the presentation we had a few minutes to share war stories as Jason ran into most of the same very difficult engineering challenges provided by working in a Javascript platform, while trying to do things that aren't common place and really only surface when you try to do things that weren't really intended to be done. It was a really interesting conversation for me, because we got to compare a lot of architectural, and technological decisions that both projects had to make. This gave us the ability to compare how these different decisions have panned out, as well as what priorities drove these decisions and why. There were a lot of big decisions that we compared especially as we were presenting at the Bay Piggies and chose to build our service in Python, which was something Selenium initially considered but wound up in a Java environment. I really appreciated all of his feedback, input and wish him the best of luck with Selenium and the big goals and expectations Google has for the project.
I was again excited for the solid turnout, all the feedback and responses by everyone. I am glad to say that I had a few conversations with people just about the status of OSAF and the exciting and interesting state we are in finally getting a usable project out the door and into the hands of the public. It was especially exciting for me to walk around the room at the end of the presentation and see that many of the people in the room had windmill running and were playing around with the test recording functionality. This means that basically anyone who can figure out easy_install and walk through our docs can figure out how to get the project up and start playing with it. This is an obvious key to getting users, because if they can't get the thing up to check it out there is a pretty small chance they will be putting any time in contributing or giving us useful feedback.
Go give it a try yourself!
http://windmill.osafoundation.org/trac/ ... ndmillBook
or jump on the mailing list to keep up on what's happening.
http://lists.osafoundation.org/mailman/ ... ndmill-dev
Wednesday, October 3, 2007, 07:43 PM - General
Life on the home front is finally calmed to a dull roar. After moving, a new kitten appeared at the house, and a new roommate was found to help manage the cost of the new house. Overall I would have to say I am very satisfied with the result of it all and considering the drastic changes other than AT&T everything has been reasonable, reliable and within my realm of patience (Comcast will be here on Monday).
So far the guest cottage has been used to it's full potential, my fountain has been filled and unclogged for a tranquil backyard experience and I have had a chance to golf Lake Chabot and Golden Gate park. This combined with a very productive sprint week at OSAF and thus far a very solid preview release of the Chandler ecosystem.

One must have a place to go relax between lines of code, right!

For the last year my cousin has had one very smart, previously feral cat named Anna Belle. She ran the house, taught herself how to open doors, play fetch and many other things I didn't know cats could do. As the dominant creature in the house hold the idea of bringing a playmate in for her was a tough sell, but it happened anyways. After a couple days of showing the little guy "Spock" who's boss, things started to relax and now I can look over and see them in a bear hug sound asleep on a chair in the living-room. Most likely because they were up all night wreaking havoc on ever item in the entire house that can possibly make noise.

At this point I am pretty surprised that they are getting along so well, but the veteran feline seems to have taken over the mother role. Every-time the little one gets into something he shouldn't she quickly reminds him. As he discovers new things (Such as playing fetch with bottle caps) she sits and observes in a very dignified and superior fashion from one of the many view points in the living-room.
Looks like we have a full house at this point, should be a good fall and winter.

I am sticking a few pictures of the new place and the kitties here in the blog post, but if you want the full tour I have uploaded them to my Picasa photos; linked from the "Links" in the toolbar to the right.
This weekend I am headed to Pullman, Washington for the WSU Homecoming weekend. Once a year I like to remind myself of the college atmosphere, bitter cold, and terrible side effects of too much cheap barley pop. Hopefully the Cougs can make it exciting, and Meg will finally get a tour of the little town hidden in the wheat fields where I spent four years getting a life experience.
Next week Windmill will be having the 0.2 release, stand by for our shift into a higher gear on exposure, development, and polish. Exciting stuff.
Tuesday, September 25, 2007, 01:48 AM - QA
Windmill: http://windmill.osafoundation.org (if you didn't know) got a promotion today as OSAF is making it an official project. Windmill has grown by leaps and bounds since our debut at OSCON, and now with 5 very active committers we have solved many of the plaguing issues, re-architected all of our bad decisions and tacked on features at an astounding rate. Our 0.2 release will be happening in the next week or so and now with the addition of Ubuntu Firefox launching and Safari browser launching we now support the full spectrum. We will be baking binaries for each of the platforms, completing the Windmill Book - which aims to be a comprehensive and organized walk through of how to use Windmill so you can easily see what it can do for you or your company.
This week alone we removed any iframes for the testing window making sure there were no issues being created by an impure environment, improved the proxy handling of threads, added functionality allowing for iframe and multiple window testing, solved Safari and Ubuntu linux browser launching, replaced the Windmill Shell, and finished a working implementation of native Javascript Unit testing functionality. Additionally functionality was added to all of the listener code allowing you to explore and record tests on your 1995 web page full of iframes embedded inside iframes.
The more people get involved, the more edge cases we find and fix so please come check it out next week and grab the release. As there will be a bit more in the ways of time allocation and resources involved in the Windmill
Project, Mikeal and I will be taking on this new goal and responsibility of "Open Source Project Promotion Specialists" with the skilled guidance of Open Source veteran Ted Leung (http://www.sauria.com/blog) to see if we can get the ball rolling here and establish a community.
If you have been frustrated with the other Web Automation solutions out there, or simply want to try something new and specially geared around testing the Ajaxyest of Ajaxy web applications come join us in #windmill on freenode or just try your hand with our new recording IDE.
Back Next


Avatar





