Wednesday, July 15, 2009

Wednesday, June 24, 2009

Tesing using Selenium and ExtJS

Selenium is probably one of the more popular web testing software out now. I have been trying to use selenium to generate some functional test for my project. Below are some of my notes/tips for using Selenium and Ext JS together. Selenium IDE was used in Firefox to generate the tests. Integration with the build server will come later.

UI Elements that don't work too well

  • Right Clicks don't seem to be captured in Selenium so if you use them, you probably got to try another way of testing.

  • Date pickers, don't seemed to work well too, i use the type command to input values into date pickers and time pickers in forms.


Asserting.

  • For textfield use verifyValue, the Target being the id of the element and the Value is the text you want to check against. Using assertText dosen't seemed to work for me.

  • You can right click on the web page and it will show a context menu allowing you to add assertions/verifications easily instead of trying to use firebug or some other tool to find the id or xpath value.


Speed
If you are using iframes in your pages, you might want to slow down your tests instead of putting it on the fast mode. This ensures that your iframes have time to load completely and that Selenium can find the link to whatever that you are clicking next.

Monday, June 1, 2009

SLIME, SBCL and Windows

I was having lots of problems setting up SBCL 1.0.22 and the latest SLIME CVS in Emacs 22.3.1. I had lots of help from the SLIME mailing list and this is my final .emacs files.

I am assuming that you have installed/unzip everything into a directory called c:\lisp on your system. WIth SLIME in c:\lisp\slime and SBCL in c:\lisp\sbcl.

(add-to-list 'load-path "C:/lisp/slime");Your slime directory
(setq inferior-lisp-program "sbcl -core c:/list/sbcl/sbcl.core"); your lisp system
(require 'slime)
(eval-after-load "slime" (slime-setup '(slime-repl))) ;This is different from the documentation

Sunday, May 24, 2009

Lessons from Robert Martin Keynote (What killed Smalltalk could kill Ruby too)

Robert Martin gave the keynote at this years Rails Conf. Beside learning about some programming history and other interesting bits of knowledge , there are a few lessons that most developers can take away from the talk.

1. Clean Code has zero WTF/min

Most interesting  way of measuring if the code is clean. All programmer should take note of this. Even when i read my own code after some time, I tend to think "WTF, what made me write that crap".

Peer review and refactoring helps in this aspect but many development teams don't do it. It takes quite a lot to make programmer's write tests when we are always faced with deadlines.

One reason is that during school,  TDD isn't really emphasized when doing software projects. Perhaps, universities and polytechnic should start teaching people what are good practices, things like Design pattern's, TDD, source control and so on. Grade projects not only on the functional and design aspects but also on the practices aspect. See if they write tests and see if their tests are maintained still work when the project is done.

2. Rules/Laws of TDD
The laws


  1. You may not write production code until you have written a *failing* unit test.



  2. You may not write more of a unit test than is sufficient to fail, and not compiling is failing.



  3. You may not write more production code than is sufficient to pass the current failing test.



3. Professionalism
Robert also talks about what being professional means. Simple to say it means not bowing down to fear and not taking corners when the going gets tough.

[youtube=http://www.youtube.com/watch?v=YX3iRjKj7C0&hl=en&fs=1]

Links

RSpec
Ward Cunningham on Wikipedia
Ward Cunningham on Twitter
Robert Martin's Page at Object Mentor
Robert Martin Page at Wikipedia
Rules of TDD

Thursday, May 21, 2009