tags:

views:

22

answers:

2

THe source code of my the legacy application I am maintaining is in many folders and subfolders.

I am starting creating unittests as a base for refactoring.

Do you suggest I put all tests in a single place or for every folder of code i create a subfolder called \FolderNameTests ?

Or do you have other suggestions?

+2  A: 

I think it makes sense to have a src folder for your source, and a tests folder for your tests, and the the directory structure under test should match the directory structure under source.

For Java, where packages affect member visibility, this is particularly important, because the directory structure reflects the packages. So not following the convention will mean you might not be able to test protected/default visibility scoped methods.

hvgotcodes
Good suggestion, I already have all my sources under a \developement folder, I will create a \unittests folder at same level
@user193655, you also mights want to create 'unit' and 'integration' folders under tests, and then recreate the directory structure for you source under those 2 dirs...
hvgotcodes
+1  A: 

I would replicate the structure so that you know where things are by looking at the original sources. If you have a lot of files, it wouldn't be a good idea to have them all in the one folder.

As mention here, in Java it would matter due to visibility access; not sure in other languages.

Josmas