Page 1 of 2

How do you test things without clients seeing it?

Posted: Thu May 14, 2009 2:45 pm
by JellyFish
I'm wondering how I can test things out before I publish them to my web server. I guess I would have to test it on another dummy server that I only have access to. How is it usually done? How do big websites develop new applications without anyone see them be developed? Do they just have a password-protected directory that they work in? Or do they have a dummy server hosted somewhere that's protected? If they have another server, they would have to change the application onces it's finished to have the correct domains, IPs, passwords, etc.

How is development and testing done if a site is already launched and running?

Re: How do you test things without clients seeing it?

Posted: Thu May 14, 2009 2:52 pm
by crazycoders
You have 2 ways:

Solution #1 (DEV/UAT/PROD setup)

This is how really big companies work. I have to work with a couple of them from time to time and the development is very structured and often slowed down but you have a lot of resources to help you develop.

This setup is comprised of 2 or 3 different development environments. All completly seperated but identical in their composition so that no error may arise from moving the project from one step to the others.

Ok i hear you... steps? Yes, see that DEV/UAT/PROD are called steps:

Step 1: Development (DEV)

This is a server where you are entitled to wreck havoc and do as much debugging as you want. It is YOUR server as a developper and this is where you test, debug, build and rebuild if something happens. Usually, the client shouldnt have access to this because it is internal and you have no requirement to keep it up and working or keep the code working.

Step 2: Users' acceptance tests (UAT)

This is where you actually push the finished software (or parts of it) to a server that is available to your client. This step is still under your control but now you have the requirement to keep it up and working. The only thing you can deal with your client and MUST deal is that live data is not always in sync and not always possible.

On this step, the client tests the software and approves how it was built and approves that there are no major problem. When the tests are done, we move to production. Note that this step is not always respected, you may work without it and only use DEV and PROD.

Step 3: Production (PROD)

This is your online server where everything is pushed to the client and what you will see as a normal client when you visit amazon.com or google.com. It is not a place to develop or do tests.

More in next post!

Re: How do you test things without clients seeing it?

Posted: Thu May 14, 2009 2:56 pm
by crazycoders
Solution #2: In production development/debugging

The second solution focuses on the fact that sometimes, you don't have access to several identical environments. To that effect, you have to develop a system that can live in a subdomain of the same server or in a subfolder of the same server.

I often use this technique with smaller client since my sites that i develop are all relative path enabled systems. I never ever use / as a base path or http://domain in my paths unless it is something that is not in my control such as an external link to another domain.

For example...
A recent system i developped was located in dev/ and in the uat/ i had put a copy of the site that was ready for client approval. So the client simply had to access http://www.mydomain.com/uat/ to see the new site and it was working fine and no problem were detected, when he asked me to push the site, i simply put an offline page in the source folder, delete the old site and move the files from uat/ to / and everything smoothly upgraded.


Any more questions, i'll be glad to help!

Re: How do you test things without clients seeing it?

Posted: Fri May 15, 2009 2:27 pm
by JellyFish
Thanks for the awesome posts. I guess the best way to develop and test is to have a second but identical server somewhere that you can mess with. Or have a directory that no one has access to except for the developers.

If I had an identical server somewhere, how do I restrict access to it? Is there a way not to host the site to the cloud but just to a select few IPs? Or is there a way to require authentication before allowing access? But if it's just password protected, what stops someone from running a keygen or something on it and cracking it?

But what about MySQL database design and testing? A directory that is closed off to the users makes sense, but how do you close off MySQL stuff? I'm thinking that maybe you'd just make a testing table and work with that. Or make a testing database that's identical to the PROD database.

When I think about it, how do I take something to the next step; from one phase to another. How do I take things from the development step over to the production step? Surely each step/phase isn't exactly identical. I'd have to change certain variables I'm sure (like mysql connection parameters, domains and IPs, etc.). But how do I change all this in time before people see broken pages? Maybe this is not such a valid question, 'cause I guess I could search and replace things before I upload them to the production server.

Re: How do you test things without clients seeing it?

Posted: Fri May 15, 2009 2:38 pm
by crazycoders
You don't necessarely need to protect your development, a good way to protect it if you use subfolders is to simply put an HTACCESS password, i'll let you browse that on the web. This can be cracked but anyway, you are developping, the hacker won't find anything good in there.

Second way, if you are using different servers is to setup the site as a subdomain such as dev.devnetwork.net but do not create a DNS entry. Leave it like this without a DNS entry and it will listen to a request for it but people won't know where to look for it. Then, in your windows HOST file or linux HOST file located at:

*NIX: /etc/hosts
Win: c:\windows\system32\drivers\etc\hosts

Add a line that matches that servername and the correct ip. You will be the only one that can resolve dev.devnetwork.net and thus hackers can never find your site because it is not advertised on the web through any service.

For the database, you need to have copies, ALWAYS.

When you want to migrate a project to the next step, well, you have to either RSYNC the whole content from server to server or use a CP/COPY operation directly on the server. Also you could simply turn off the site, delete all files from the step you wish to update and push the new files via FTP.

For the MySQL databases, you need to be well organised, all changes to the database must be tracked. PHPMyAdmin for instance doesn't show you the SQL that you run each time you update something for nothing... Its actually to prevent you from having to type them yourself and you can easily copy and paste them into a script file that you will run later on the next step. This will put your databases up to date.

I think thats all!

Re: How do you test things without clients seeing it?

Posted: Fri May 15, 2009 3:20 pm
by Eran
Do yourself a favor and use file-versioning such as SVN instead of FTP / RSYNC to keep your enviroments in sync.

Re: How do you test things without clients seeing it?

Posted: Fri May 15, 2009 3:22 pm
by crazycoders
Can you use SVN to push files to a webserver? O_o
I use sourcesafe for my versionning and i never saw a real need to investigate SVN...

Re: How do you test things without clients seeing it?

Posted: Fri May 15, 2009 3:45 pm
by Eran
Of course, that's it's one of its main features - synchronizing between work environments.
Every development environment we run (local, staging, production) is a checkout of the same SVN repository (perhaps with different branches but not necessarily). We commit regularly to our staging environment (which auto-updates via a post-commit hook) and there it undergoes QA. When it clears QA it is pushed to the production environment (usually as a part of a build script in Phing, which also runs tests and sets permissions etc).

Re: How do you test things without clients seeing it?

Posted: Fri May 15, 2009 3:54 pm
by John Cartwright
pytrin wrote:Do yourself a favor and use file-versioning such as SVN instead of FTP / RSYNC to keep your enviroments in sync.
Wouldn't dream working without it!

Re: How do you test things without clients seeing it?

Posted: Fri May 15, 2009 7:34 pm
by JellyFish
I'm not sure I understand most of what you guys said. What's a DNS entry? What's SVN? What's RSYNC? 8O :?

Re: How do you test things without clients seeing it?

Posted: Fri May 15, 2009 8:48 pm
by ldougherty

Re: How do you test things without clients seeing it?

Posted: Wed Aug 19, 2009 8:29 am
by richermartyn
Thank you Crazycoders,
I am Richer Martyn,
I like the information you shared. I exstreamly thanking you. Be connected with me and help after this time also.

Re: How do you test things without clients seeing it?

Posted: Mon Sep 14, 2009 10:25 am
by josh
Were you suggesting using an SVN working copy for the production environment? That's a bad idea for a multitude of reasons, mainly when merges fail.

The way I do that is I have a working copy on a linux box I check code into, I can test there if I want but I test on my machine before I check it in anyways. Then I wrote a shell script that runs on my manual invocation. It updates that working copy to the head revision, and then invokes rsync to actually move the files. The reason for this instead of an export is that resets the file modification times under some environments and causes the whole codebase to transfer.

If you are just updating a working copy directly to production, not only are you exposing your .svn files which contain in plaintext passwords that are embedded in your code, if you ever have to edit on the production server during an emergency and do an update later, if the merge fails SVN inserts text like ">>>>mine r.2503" which causes PHP syntax errors or unfriendly output

Re: How do you test things without clients seeing it?

Posted: Mon Sep 14, 2009 10:39 am
by Jenk
I'd have thought this was a no-brainer... you have a replica server behind closed doors.

Anyway.. why not let clients see your progress, and allow them access to it as well? It is much more professional to allow your clients to interact with your software, and provide feedback, as soon as possible, rather than saving it all for a big bang deployment.

Re: How do you test things without clients seeing it?

Posted: Tue Sep 15, 2009 1:52 pm
by josh
What if you are doing a large refactoring and you want to check in at regular "checkpoints" so you can revert part of the refactoring if needed, in that case you dont neccessarily want the client on there because they think its bugs rather then unfinished changes..