The development team behind
Gaia Ajax Widgets are in these days extremly focused on
code-quality. The reason is that first of all we've had some really obscure bugs in Gaia but probably the most important reason is
that we CAN.
Kariem (our Unit Testing Hero) has been spending large amounts of the last development cycle researching into how to Unit Test a GUI library. To Unit Test a GUI library is far more difficult than to Unit Test about every other piece of software on the planet. The reason is that a GUI library (like Gaia Ajax Widgets) needs
user interaction. This user interaction is off course very difficult to achieve without having a user sitting in front of the computer. And without an
automated test engine it is off course impossible to create Unit Tests.
We've done a lot of research into this and Kariem which was the Project Manager for our testing system finally decided on using
WatiN. WatiN can simulate a user having interaction with a browser and basically implements a lot of the features needed to do Unit Testing on GUI libraries. There were several reasons why we wanted to move on with WatiN, the most important one was integration with
nUnit and strength of automation, but it was also of great importance that WatiN was Open Source.
When I write this I am sitting on a train which is my first means of transportation to Portugal to visit a client. The nature is very beautiful outside (Norway is one of the most beautiful countries in the world) and my thoughts are drifting. I have just now fixed a couple of bugs in Gaia PlaceHolder which we probably never would have known about if it wasn't for Kariem's Unit Testing efforts. I wrote a test about something I assumed would work and it *didn't work*. So I fixed it and we now have that Unit Test for later references if we want to refactor the internals or add features that might break those parts of the logic later.
I stare out the window looking for words and it occurs to me that Unit Testing have a couple of interesting traits shared with the way nature itself works. If you are a Darwinist (I am) you believe in
The Survival of the Fittest. That means creating something and throwing it out to see if
it works. The world is basically one huge gigantic Unit Test for species and life. God in his infinite wisdom created the possibility to change the bio-mass on this planet through mating and random mutations. This makes the world evolve and change all though this sometimes seems to take forever. Humans don't have a long enough life expectancy to see these changes.
And the same way God uses "test cases" which he throws out in the world to see how they manage we can create Unit Tests in Software to see how the world manages. If the test fails, we can fix the world (our GUI library) until the test works and keep the test for later reference just as the
memory of nature makes sure through our DNA and its capability to mutate that no earlier mistakes are repeated. Then if/when it works we have evolution. Kind of like the way for instance the eyes of animals was invented through random mutation and over time evolved into something that worked. Then when it worked it was replicated due to Survival of the Fittest to such an extent that at the time being almost no specie today can live without a pair of them.
Unit Testing works the same way. When we try out something new and it doesn't work we change our "world" until it works. And when it is near perfection we can reuse that part of our "world" and replicate it into other parts of our Software through patterns like composition, inheritance and so on.
Art imitates life. All great inventions imitates some aspects from nature. Simplicity works, complexity is bound to die. Down to the very last piece of source-code. Even the shape of the hairs on our head has been Unit Tested heavily through up the milleniums. When Unit Testing for a couple of billions of years everything is bound to become very good. We humans are so extremely evolved at the time of this writing that we're almost at the brink of doing a
killfile on nature itself. We now have so much power that we're able to destroy the entire Earth in our chase for more. If we do not stop this behavior NOW we will destroy what nature has spent a billion years building. We can and must not let this happen. We might be the specie in the entire Universe with the largest intelligence ever created. Let us all show nature that intelligence is constructive. Let us show nature's Unit Tests that intelligence is something worth keeping so that nature doesn't do a "killfile" on the entire concept of intelligent thinking.
We need to fix the world NOW! Don't let 1 billion years of Unit Testing be in vain! And if you think that you cannot contribute since you are not working in a Chinese coal-plant, think again! If your excuse to not bother is that you are creating source-code which doesn't influence the Earth's level of CO2 then you are ignorant. Ignorance is the path to damnation. If everybody was thinking "this is not my problem" in 1940 then Democracy would have been just another failed Unit Test. But thanx to nations who's "problem it was not" we were able to do a killfile on Fascism and fix a global problem. The Earth is now calling to arms again, are you ready to pick up your sword. We need every sword to win this battle! Also the swords of those "who's problem it is not"!
If you have no ideas about where to start then a good place to start is our
Gaia Programming Contest. Do not let these times be our last. Pick up your sword and let us all start creating Unit Tests for this problem. In 1942 even a suburban house-wife making dinner for her husband from the rural areas of Utah was a soldier! The Earth needs your tears, sweat and blood one more time! These are yet again the times to pick up our sword and fight for the very right to live on as a specie on that little blue dot in the Galaxy we all call home...