cucumber / cucumber-jvm

Cucumber for the JVM
https://cucumber.io
MIT License
2.7k stars 2.02k forks source link

1.0.9 multiple backend stuff doesn't work so well #327

Closed dkowis closed 7 years ago

dkowis commented 12 years ago

EDIT: still a problem with 1.0.9

Glue paths being passed to the cucumber-jvm CLI executable: --glue src/test/features --glue step_definitions

Obviously, src/test/features is a path for our ruby step definition files, and then step_definitions is a package name for our java classes that are step definitions.

     [java] Exception in thread "main" java.lang.IllegalArgumentException: Not a file or directory: /home/dkowis/gitwork/itsm/incident-service/step_definitions
     [java]     at cucumber.io.FileResourceIterator$FileIterator.<init>(FileResourceIterator.java:54)
     [java]     at cucumber.io.FileResourceIterator.<init>(FileResourceIterator.java:20)
     [java]     at cucumber.io.FileResourceIterable.iterator(FileResourceIterable.java:19)
     [java]     at cucumber.runtime.jruby.JRubyBackend.loadGlue(JRubyBackend.java:64)
     [java]     at cucumber.runtime.Runtime.<init>(Runtime.java:63)
     [java]     at cucumber.runtime.Runtime.<init>(Runtime.java:50)
     [java]     at cucumber.cli.Main.run(Main.java:18)
     [java]     at cucumber.cli.Main.main(Main.java:12)

We have a jruby backend and a spring backend. I haven't had an opportunity to look into the code, but probably something that should be fixed in the jRuby Backend.

aslakhellesoy commented 12 years ago

Someone reported (in a commit comment) that the same exception is thrown if a dir is in fact a symlink to a dir. Need to track this down too before closing this issue.

dkowis commented 12 years ago

I built this sample project here that demonstrates the right way to do it: https://github.com/dkowis/cucumber-jvm-hybrid-example

I bet if I change my glue paths on my other larger project to be --glue classpath:step_definitions, everything will work out just fine. The sample project I put together successfully runs multiple backends at the same time without any issues.

There might still be issues regarding detection of directories and such, and it should probably still handle things correctly, but it's not a show-stopper for anything (yet.)

:)

aslakhellesoy commented 12 years ago

I was unable to run your dkowis/cucumber-jvm-hybrid-example - running mvn initialize -Pinitial-bundle doesn't install bundler. All I get is:

$ mvn initialize -Pinitial-bundle
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Examples: Hybrid Cucumber-JVM Backends 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.135s
[INFO] Finished at: Wed Jun 13 07:36:32 BST 2012
[INFO] Final Memory: 2M/81M
[INFO] ------------------------------------------------------------------------

That aside, what's left to do before this issue can be closed?

dkowis commented 12 years ago

it appears that it's still being run as part of the generate-test-resources phase. Whoops.

                        <phase>generate-test-resources</phase>

I forgot to change the phase in the pom.xml.

But that initialization stuff should only be needed for using this pom in a new project. I've checked in the bundler code, so you should just be able to do mvn clean verify and it'll do everything it needs to do.

I think all that's needed to be done is to not have the backends barf when something is not a directory, or a symlink.

aslakhellesoy commented 12 years ago

@dkowis

I'm still struggling to build your example. Here is what I tried:

$ git clone https://github.com/dkowis/cucumber-jvm-hybrid-example.git
$ cd cucumber-jvm-hybrid-example
$ mvn clean verify

[INFO] --- maven-antrun-plugin:1.6:run (default) @ hybrid-cucumber-jvm-example ---
[INFO] Executing tasks

main:
     [echo] Doing bundle install
     [java] NameError: undefined local variable or method `home' for main:Object
     [java]   (root) at /home/aslakhellesoy/src/github/cucumber-jvm-hybrid-example/src/test/gems/bin/bundle:1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.707s
[INFO] Finished at: Mon Jun 18 13:39:10 BST 2012
[INFO] Final Memory: 7M/180M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (default) on project hybrid-cucumber-jvm-example: An Ant BuildException has occured: Java returned: 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

You said you had checked in the bundler code, but I have nothing under src/test/gems/bin/bundle

Still can't reproduce what I need to fix this issue.

dkowis commented 12 years ago

Apparently I can't think very well. You can do this: mvn clean verify -Pinitial-bundle.

It will then bomb because the gemfile exists. And then it fails because the newest version of bundler actually doesn't work within jruby. I'll make some more commits to this to get it working again. Sorry about that.

So, gimme a few more minutes to get it working again :(

lunivore commented 7 years ago

Hi @dkowis, I'm curating old tickets. Is this still an issue for you with the latest version? If so, please point us to some working code or let us know that you're working on it still. Otherwise if I don't hear back from you, I'll close this in a week.

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.