How Do Professional Programmers and Developers Test Their Work?

By | October 29, 2009

This article will cover a few of the techniques and tools used by professional web developers, designers and programmers in their work to test new code and improve their software/websites. Many people don’t know about this, and end up spending much more time on testing (uploading, changing code, troubleshooting) than needed.
This will be very useful to you if you are just starting out in any web development language like PHP, ASP, Javascript and others or if you just have a site that you want to maintain and improve yourself.

Let me start by saying that professionals rarely change and test their code via an FTP client right on their web server. This is because it takes a lot of time to download, edit and re-upload a file via FTP (especially when you’re changing just a line or two of code, or your Internet connection speed is less than stellar) and because they don’t want their visitors to notice any strange things on the website while they are testing the code.

So, what do they do?
They work and test everything locally, which means they have a copy of their website and database in a folder on their computer and they change those files and see the results immediately in any web browser. I’m going to show and explain a few tools used for this purpose in Windows (Linux and Mac OS X are a little different, although you can easily use the tips here for those Operating Systems, too).

To be able to see your website on your computer via any web browser requires you to install a web server (Apache, Microsoft IIS, Lighttpd or any other) on your computer and route it to your localhost IP address (which is 127.0.0.1 by default). If this seems complicated, don’t worry, it is not!

Installing a web server for testing purposes on your Windows machine is as easy as installing Mozilla Firefox, MS Office or any other application. It is a simple matter of downloading an installer and running it.
There are 2 best programs for this purpose: WAMPServer (Windows, Apache, MySQL, PHP Server) and XAMPP (Apache, MySQL, PHP, Perl for Linux, Windows, Mac OS X and Solaris). While XAMPP is cross-platform and has Perl support, I prefer WAMPServer because it is simpler to install, configure and use.
To download it, go to http://www.wampserver.com/en/download.php and click “Download WampServer” (optionally you can download any version of MySQL, Apache & PHP from the Addons page). After installing, start it up and you should see a tray icon (that looks like a speedometer) showing its status.

download wampserver

It must be white with the arrow pointing to the right. If it is yellow or red, then something is wrong. Most of the times WAMP has problems running along with a firewall, antivirus or Skype. In my case, I had ESET Smart Security (which acts as a firewall and antivirus) and Skype installed and got an error the first time I started WampServer, then the icon was yellow all the time. It was quite annoying and I spent a lot of time trying to figure out what’s wrong.
I’m going to save you a lot of time by telling you the solutions to these problems.

First, if you have ESET SS (quite a fitting name for its very strict firewall :-) , turn the firewall and the antivirus off before starting WampServer for the first time by right-clicking on the tray icon, then clicking “Do not filter network traffic (Disable Firewall)” and “Disable Real-time file system protection”.

disable eset smart security wampserver

If you are really worried about your machine’s security, you may leave the file system protection online and disable only the firewall. It should work, but if it doesn’t, you have to disable the antivirus, too.
After doing that, start WampServer. If it gives no errors and the tray icon is white, then everything started correctly and should now work. You can re-enable ESET Smart Security, and the next time you start WampServer, you shouldn’t have to do this again.
To test if it’s working, open your favorite browser, type “localhost” (or http://localhost/) in the address bar and press “Enter”. You should see a test page describing WAMPServer (in my case it was a simple line of text inside an index file).

testing wampserver in browser

Now, if the tray icon is yellow AND you have Skype enabled, then WAMP conflicts with it. Here’s what you need to do:
Open Skype, go to Tools->Options->Advanced->Connection and uncheck the “Use port 80 and 443 as alternatives for incoming connections” checkbox. Skype will still work, but will not conflict with WampServer over those 2 ports.

changing skype settings to settle conflict with wampserver

Close Skype (and WAMPServer, of course) and start them again. Skype and Wamp should be now working perfectly together. You can also restart your machine and try starting them again to make sure they’ll really work in the future.
Now that everything works fine, you’ll need to make a copy of the website and the database. This is a simple matter of copying the files from the web server (all of them from “httpdocs” or “public_html”) to WampServer’s WWW folder (which is inside the installation folder, default is C:/wamp; or you can left-click on the tray icon and click “www directory” to open it).

I think you know how to transfer files from the server to your computer, so I won’t describe it in detail. Copying the database is accomplished with phpMyAdmin (left-click on WAMP tray icon, then click “phpMyAdmin”), which you need to know how to use. It is quite easy, but is beyond the scope of this article and you’ll have to use Google to find some instructions (just search for “how to export and import databases with phpMyAdmin”).

So there, now you know the tools used by professional developers to test their work and you won’t have to wait 10 minutes and inconvenience your site visitors just to test a change in the code of your site or web application.


Comments are closed.