ExtDiamond

What is ExtDiamond
ExtDiamond is a tiny framework that will help you to write rock-solid tests for ExtJS applications, without taking care of the weird HTML code autogenerated by Ext.

Why ExtDiamond
The biggest problem of testing ExtJS applications is all about the autogenerated HTML code.
Let’s suppose you have a FormPanel with some fields. You write a test for it. Then you add a simple toolbar with a fake button. Your test should still work, but it won’t. The toolbar “stole” an id to the other components in the page (fields, for example) and the test will not work anymore. This will never happen with ExtDiamond: your tests will become unbreakable, like a diamond.

A prerequisite
Forget Selenium IDE. You have to start writing tests by hand, as you do for your server side stuff. Wait a minute, if you are not testing your server scripts, consider reading something before. For PHP/PHPUnit I recomend Practical PHP Testing written by my colleague Giorgio Sironi.

How it works
You need to reach your objects via a start point. So you have to assign some CSS classes (see cls on ExtJS API) to your main components under test. For example you can assign a class to a window that contains something to test. End of DOM references.
Reached that component, you will write assertions using something like a domain-specific language, mostly provided by ExtJS itself and in part by ExtDiamond.

Dependencies
ExtDiamond is written in PHP  and is a kind of extension of PHPUnit. It uses Selenium RC to talk to the SUT.


Figure 1. The big scheme of things

Is this only for PHP?
If you mean “do I have to write tests in PHP?”, the answer is yes. Of course the idea can be ported to other languages, but I won’t.
PHP is very simple and if you know {put your favourite object-oriented language here} all you need in order to write ExtDiamond tests can be learnt in a hour.

Check it out

-> see all the posts about ExtDiamond on this blog
-> read the cookbook
-> download the last version
-> contribuite to this project by contacting me

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>