Question

I'm working on a project with a maven structure and I want to begin doing some extended tests, but I'll need to a large amount of resources do to so. Any recommendations where I should place these resources? Should they go into 'src/main/test/resources' or be pulled from a different repo or something else?

Was it helpful?

Solution

Recapping your question

Any recommendations where I should place these resources? [...]

I'm aware that I can place them in 'src/main/test/resources' [...]

I'm thinking more of resources for integration tests. Developers won't necessarily want to pull a 100's of megs of resources from version control for tests they likely won't run.

Answer

You might change to a multi-module project layout, something like:

      multi-module project
              |
              |
          +---+-----------------+ 
          |                     |
source and unit test    integration test
         prj                   prj

then your developers could pull only source and unit test prj.

Clearly integration test prj should have a compile scoped dependency on source and unit test prj.

OTHER TIPS

Maven has an answer for you...

If you include the resources inside the 'src/main/test/resources' (that's correct)...

Remember that running an install in the final jar the tests will be excluded, and yes! The resources are excluded too...

Moreover you could skipping tests (also the compilation) to improve compilation performance... (more info at: http://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-test.html)

I hope this helps you...

UPDATE:

also give a look at "How can you display the Maven dependency tree for the *plugins* in your project?"

We should think about the reasons for excluding resources from the environment of the developer. I just answer your question telling the common practice of handling situations like yours by Maven...

If as you say it is actually a problem for you, it may be an idea, for example, to separate all the tests and resources inside another moduel...including that in your parent pom... Or maybe to define a profile (integration test) which will contains largely of test resources, and a profile (Developing test) that will only lead tests useful to the individual developer ...

I personally think that unless there are special reasons (critical), beyond simply the amount of mega occupying test, you can safely proceed with all the resources in the test package...

You should run this kind of large integration tests on a CI server, not on developer machines.

It's good practice to run long-running integration tests on a different machine to reduce the dev-test cycle time. You wouldn't want to run that in your normal builds anyway, make a profile and run it on CI.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top