I'm using Bazaar for version control, which I'm very happy with. In Bazaar every tree/project in source control is called a 'branch'.
Currently I have a 'main' branch for the actual application, and a 'dev' branch which houses some things like unit tests, as well as the user manual, etc. This way, both the app and its associated tests are versioned, but separately.
However, I suspect that the way I'm doing it is not the best way. For example, if I were to create release branches from that 'main' branch, then these release branches would get out of sync with the unit tests, unless I branched those in the same way.
Currently, in order to create a snapshot of the application, I just export all files from that main branch and zip them up, because there is nothing in that branch's tree that isn't part of the app that will get sent to clients.
What would be a better way to do what I'm doing? Should the unit tests go into that same 'main' branch as the app, and if so what is a convenient way to easily create a 'snapshot' ie the equivalent of a 'daily build' which contains only the files that will be distributed with the app?
Thank you all for your answers. It was hard to decide whose answer to accept. The solution I've gone with is to have my tests within a 'tests' subdirectory of my main tree; I could easily strip that out later if I didn't want to distribute the tests.
You definitely want to keep your unit tests and code as close as possible. The process we follow is such:
libs/Core/Login.php
libs/Core/Process.php
libs/Core/t/LoginTest.php
libs/Core/t/ProcessTest.php
Basically, create a unit testing module for each part of your code, and separate it from the real code by keeping it in a subdirectory. Then have something go through, find all of the unit testing code and run it before you push to production.