Reading articles and forums topics on different sites I've found out that the common practice is to separate tests from the production code putting them into separate folders, namespaces and furtermore, in the separate modules.
It seems strange a bit for me - because I think it is good idea to have unit tests to be well-integrated with the code. Otherwise it can cause the code and tests to get unsynchronized. In the case the project can be built excluding tests developers could stop to write tests for some time assuming they could have some more time in the future to get back to tests.
Another reason to put the code and tests together is resulted from following assertions: 1. Tests are the best documentation (after code itself) 2. It is better to put the most of documentation right into the code than into the separate document
And finally, what is the good reason to exclude tests from distribution assembly except the size reduction? Why to reject the ability to run tests on the client computer and to get sure the code still pass them successfully?
I use to place tests in the same folders and namespaces as classes what are being tested. Is there any significant reason not to do so?
Personally I do not feel that Unit Tests help document the code. I understand that well written code can be self documenting, however majority of the time I have to write a users manual. So I fail to see any benefit in having the Unit Tests help with code documentation.
I also fail to see why anybody would want to publish tests for production quality code. I can't really think of too many (actually none) people/companies that do this. To me Unit Tests (among other types of testing) are used just for that phase. I do not see people publishing their design documentation.
But I would also like to hear other peoples opinions.
Tests are good documentation, but it's mostly not required when interface is already in complete state. Tests are usually for regression testing, and it's unlikely that library'll get changed by users. It's reasonable to include tests if there are major portability issues. If tests are separated, there is a simple option of excluding them. At least there is no reason to include them in binary.