I have the following project structure:
MyProject
--src
--test
--acceptance
--step_definitions
--features
--unit
Is this possible?
Yes, it is possible. I believe you should separate your unit from the acceptance/integration tests having:
Slightly modified folders structure for both of these, placing your integration test files in the standard location of src/it
:
MyProject/
src/main/java/
(SUT)src/test/
(unit test code)
java/
resources/
src/it/
(acceptance/integration tests)
java/
(steps definitions)resources/
(feature files)Moreover, by design, different Maven plugins are intended for unit and integration tests:
You must also bind execution of maven-failsafe-pulgin. To run the integration tests separately, you can define a new profile:
acceptance-tests
maven-failsafe-plugin
2.12
integration-test
verify
You will also need to configure the plugin to search the src/it
directory tree for test cases.
The acceptance tests can be run afterwards using:
mvn clean verify -Pacceptance-tests
For complete sample, I'd suggest you to follow http://www.weblogism.com/item/334/integration-tests-with-cucumber-jvm-selenium-and-maven