cucumber-attic / cuke4duke

Cucumber support for the JVM: Java, Scala, Groovy, Clojure, Ioke, Javascript, Spring, Guice, PicoContainer, WebDriver, Ant and Maven
http://wiki.github.com/aslakhellesoy/cuke4duke
MIT License
256 stars 72 forks source link

Configure Source Directory #121

Open bob12321 opened 13 years ago

bob12321 commented 13 years ago

Hi All,

I am currently using cuke4duke via Maven, and I have a bit of an atypical setup. I want my unit tests to live in src/test/java and have these built and executed at all times when i hit the maven integration-test phase.

If I activate a separate maven profile (-P cucumber), only then do I want the cuke4duke plugin to be referenced. This is vital, not just preventing the execution of cucumber tests without the profile = but preventing maven from trying to resolve the plugin (it's not in my standard repo, so i have to add the extra flag to include the cukes repo).

To prevent maven trying to compile my cuke steps when I am not in the "cucumber" profile, I am keeping my step definitions in src/cukes/java. This is conditionally brought into the compilation if the profile is activated via the following config:

                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-test-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/test/cukes</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

I have managed to make this work for me, and the tests are being executed as expected. However, cuke4duke is failing to find the source directory to attach snippets to my test failures; as such I get the following....

Couldn't get snippet for com/bobsmith/randompackage/RandomSteps.java

Is there a way to specify a source directory to cuke4duke to help with this resolution?

Thoughts?

Bobbie.