<p>I'm familiar with TDD and use it in both my workplace and my home-brewed web applications.  However, every time I have used TDD in a web application, I have had the luxury of having full access to the web server.  That means that I can update the server then run my unit tests directly from the server.  My question is, if you are using a third party web host, how do you run your unit tests on them?</p>

<p>You could argue that if your app is designed well and your build process is sound and automated, that running unit tests on your production server isn't necessary, but personally I like the peace of mind in knowing that everything is still "green" after a major update.</p>

<hr>

<p>For everyone who has responded with "just test before you deploy" and "don't you have a staging server?", I understand where you're coming from.  I do have a staging server and a CI process set up.  My unit tests do run and I make sure they all pass before an an update to production.  </p>

<p>I realize that in a perfect world I wouldn't be concerned with this.  But I've seen it happen before.  If a file is left out of the update or a SQL script isn't run, the effects are immediately apparent when running your unit tests but can go unnoticed for quite some time without them.</p>

<p>What I'm asking here is if there is any way, if only to satisfy my own compulsive desires, to run a unit test on a server that I cannot install applications on or remote into (e.g. one which I will only have FTP access to in order to update files)?</p>

[{'answer_id': 20517, 'author': 'Cheekysoft', 'author_id': 1820, 'author_profile': 'https://Stackoverflow.com/users/1820', 'pm_score': 1, 'selected': False, 'text': '<p>You could write functional tests in something like <a href="http://wtr.rubyforge.org/" rel="nofollow noreferrer">WATIR</a>, <a href="http://watin.sourceforge.net/" rel="nofollow noreferrer">WATIN</a> or <a href="http://selenium.openqa.org/" rel="nofollow noreferrer">Selenium</a> that test what is returned in the reponse page after posting certain form data or requesting specific URLs.</p>\n'}, {'answer_id': 20526, 'author': 'sparkes', 'author_id': 269, 'author_profile': 'https://Stackoverflow.com/users/269', 'pm_score': 0, 'selected': False, 'text': "<p>I've written test tools for sites using python and httplib/urllib2 generally it would have been overkill but it was suitable in these cases.  Not sure it's going to be of general use though.</p>\n"}, {'answer_id': 20534, 'author': 'Shaun Austin', 'author_id': 1120, 'author_profile': 'https://Stackoverflow.com/users/1120', 'pm_score': 2, 'selected': False, 'text': '<p>I think I probably would have to argue that running unit tests on your production server isn\'t really part of TDD because by the time you deploy to your production environment technically speaking, you\'re past "development".</p>\n\n<p>I\'m quite a stickler for TDD, and when I\'m preaching the benefits to clients I often find myself saying "you can\'t half adopt TDD, it\'s all or nothing" </p>\n\n<p>What you probably should have is some form of automated testing that you perform "after" deployment but these are not part of TDD.</p>\n\n<p>Maybe you should look at your process again. </p>\n'}, {'answer_id': 20537, 'author': 'Grant Goodale', 'author_id': 2334, 'author_profile': 'https://Stackoverflow.com/users/2334', 'pm_score': 1, 'selected': False, 'text': '<p>For clarification: what sort of access do you have to your web server?  FTP or WebDAV only?  From your question, I\'m guessing ssh access isn\'t available - you\'re dropping files in a directory to deploy.  Is that correct?</p>\n\n<p>If so, the answer for unit testing is likely \'do it before you deploy\'.  You can set up functional testing driven by an automated tool like <a href="http://selenium.openqa.org/" rel="nofollow noreferrer">Selenium</a> to test your app remotely via the web interface, but that\'s not really unit testing the sense that you\'re restricted to testing the system as a whole.</p>\n\n<p>Have you considered setting up a staging server, perhaps as a VMWare instance, that mirrors or at least mimics your deployment environment?</p>\n'}, {'answer_id': 20541, 'author': 'Kristopher Johnson', 'author_id': 1175, 'author_profile': 'https://Stackoverflow.com/users/1175', 'pm_score': 1, 'selected': False, 'text': "<p>What's preventing you from running unit tests on the server?  If you can upload your production code and let it run there, why can't you upload this other code and run it as well?</p>\n"}]
['https://Stackoverflow.com/questions/20511', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1574/']