Tim Driven Development | Test until the fear goes away
Tim Driven Development | Test until the fear goes away
Tapas Chand wrote:If you look at the above structure given by Tim, it is not only different package for testing, but the parent directories are different altogether.
When you create a maven project, the source goes under "src/main/java" and the test goes under "test/java"
Junilu Lacar wrote:
Tapas Chand wrote:If you look at the above structure given by Tim, it is not only different package for testing, but the parent directories are different altogether.
When you create a maven project, the source goes under "src/main/java" and the test goes under "test/java"
Not quite right. If you look at the example that Tim gave, the packages are actually *the same* except that the unit tests are organized under a different directory in the file system (src/test/ instead of src/main). Also, integration tests in a Maven project are usually placed in the same parallel package structure under the src/it folder.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Tim Holloway wrote:Tim Cooke's sample directory structure is the standard for projects built with Maven. So not only does it organize mainline code and test code/data into separate compartments, it allows Maven to be used to automatically compile code and run tests with minimal project-specific configuration.
Keeping test and mainline code/data/classes in separate physical directories has many benefits. You shouldn't be incorporating test code or data into production builds, so by only using the mainline source to build production components, you don't get all the extra bulk of test code (and possible security risks as well!)
Eclipse fits well into this scheme. Instead of dumping everything Eclipse compiles into one big folder, you can assign specific class folders to specific source folders so that the test classes remain segregated from the mainline classes but still appear in the classpath when running tests from within Eclipse.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Consider Paul's rocket mass heater. |