From time to time I see bugs in the code and I start thinking "really? is it possible that no one noticed that bug before? am i the first person to see this code?". I thought it might be worth writing a little post on what helps me to deal with bugs and software quality in general and what are the common pitfalls in developer's thought process. Although it is not a very extensive post i hope it may inspire some developers to try new approaches :-)
In general it is extremely rare for me to commit bugs that would make it into production (maybe less than one a year? hard to say as it is really rare). To be honest I can't remember a serious issue with my code for last 5 years.
There are many ways to implement mobile version of your website but easiest and probably cleanest one is to use mobile subdomain.
Once you have your mobile website you want to implement an automated test suite to be able to regression test the functionality after every release. You also want the test suite to be easy to configure and run it against test environment. In perfect world you want the test suite to run as part of the continous integration setup. Jmeter allows for all of that and is free. As a huge fan of jmeter i recommend you download it and play around with it as soon as possible.
In this article I describe how to create a test suite for mobile website redirects, you can also download my jmeter test plan and customise it to test your own websites.
Jakarta jmeter is an awesome tool. I deeply encourage to experiment with it. If you want to see more details on how it is implemented or write your extension it may be worth compiling it from sources on your machine.
Here is a quick guide how to setup a eclipse project and what to do to build jmeter from sources and run it locally.
Few days ago i had to write a groovy test for a java class and i had a long chain of calls to mock. I was not sure how to test it nicely and i started wondering is there a nicer way to do it in PHP. Usually in PHP there is a nice way to do almost anything :D
Personally i think it is a good book but it lacks details, tools and practical solutions. Reading the book is quite enjoyable and it definitely contains a lot of useful tips and tricks.
What i liked the most is the fact that the book is meaty and condensed down to less than 150 pages. I really like books that are focused so i was not disappointed here.
The thing that author covers really well is the analysis and preparations of the testing plan and processes around it. You will read a lot about what to consider, how to prepare your self, what to check etc. There are also some useful checklists.
I needed a simple tool to automate mouse movements and delays on my PC. I like playing with Java so i wrote a simple one in a few hours.
Its a really simplistic app and it might have some bugs so please be understanding :-) But i could not find any free tool that would do exactly what i wanted to i thought i could share it to the public. Maybe someone will find it useful.
If you like it and want to modify it for your needs i think i might send you source code.
Setting up mouse control sequence
So to see mouse position click on track button, you can stop tracking if you are done. Then you move mouse where you want on the screen and write down location. Then write up a script like this:
Jmeter is a very useful tool for not only performance tests but also for automation of all sorts of web tests. Its not as powerful as selenium when it comes to ajax etc but it still allows to login, keep session and execute any sequence of http calls.
In addition to ab (apache benchmark) and curl it comes in handy when you want to stress test your applications to see the capacity and possible bottlenecks.
A funny thing happened to me the other day when i noticed a new operator (adnotation) supported by php unit.
So there apparently is a way to ignore parts of the PHP code from code coverage report.
If you put comments like below around some code it wont be counted at all during code coverage.
First of all, i was never a fan of static calls and variables as i always thought they cause problems. Using a lot of statics you might experience values leaking through different parts of application and you cant isolate functions (cron/testing/overrided environments). In general the encapsulation is gone and coupling explodes.
What i did not realize until this year, was the fact how difficult it is to create new unit tests for code filled with static calls and references. Its just impossible to deal with code that calls stuff like this:
PHP has a very useful extension for caching op codes as well as custom values from php code. The problem is that it does need additional parameter to be enabled in the command line interface (unit tests or cron scripts).
About the author
Hi, my name is Artur Ejsmont,
welcome to my blog. I am a passionate software engineer living in Sydney and working for Yahoo!
If you are into technology, you can order my book Web Scalability for Startup Engineers on Amazon. I would love to hear what are your thoughts so please feel free to drop me a line or leave a comment.