Test driven with Python
In the Software Architecture course I was introduced to test driven development. Today I tried some of it in Python - - and boy, it's a great way of developing!
I used this today for building upload support for ajaxianCMS. My first task was to code the application logic. I did this by testing and implementing one function at a time (ex: I first created a function called test_getFileById, then I implemented getFileById function). After I was done I had 6 test functions that tested every aspect of uploading a file. After this it was very trivial to code the web front end (since my functions just worked and did not need any testing). My overall impression is that it takes a longer time to implement the functions, but that time is very well spent! One gains more confidence and future requirements get easier to implement since one already has tests. I can really recommend trying the test-driven approach. I use py.test which is a non-standard library for Python that simply is amazing. Check it out ;) |
|