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

Step definitions inside jar #127

Open klemensl opened 12 years ago

klemensl commented 12 years ago

Hi,

i have bundled some default step definitions i want to use in different projects in a jar file. Now i want to include those step definitions in the cuke4duke executions but i always get the error message, that the steps are undefined - so i guess cucumber is not able to find the step definitions inside the jar file. Is that not possible or do i have to include the jar file in a special way (--require)?

thx, br klemensl

czulehner commented 12 years ago

Hi, having the same issue. Neither -r not -j seems to work.

A cumbersome workaround might be to extract the files from the jar into a local directory before execution... any other idea?

TIA Chris

klemensl commented 12 years ago

Hi,

well I have written my own ObjectFactory, more or less a 1 on 1 copy of the PicoObjectFactory but with the addition, that the step definition files of the .jar a added to the container as well. That works fine for me.

br klemensl

Mit freundlichen Gruessen,

Klemens Loschy SEQIS Consulting


SEQIS GmbH - The Austrian Software Test Experts! Neusiedler Straße 36, 2340 Mödling, Austria Telefon: +43 2236 320 320 - 0 Fax: +43 2236 320 320 - 350 mobil: +43 664 TESTS 06 (+43 664 83787 06)

web http://www.SEQIS.com, http://www.KeepLiquid.com


Dr. Bernhard Burger, Manager Quality Assurance, UC4 Software GmbH über SEQIS: „Hohe Qualitätsstandards sowie professionelle Kundenbetreuung zählen zur UC4 Unternehmensphilosophie. Mit SEQIS haben wir einen kompetenten und flexiblen Partner als Unterstützung im Qualitätssicherungsprozess. Für mich zählt dabei vor allem das Vertrauen, das ich in die Partnerschaft mit SEQIS haben kann. Für unser Projekt haben wir einen hochqualifizierten SEQIS Testexperten bei uns im Haus, den ich auch als Persönlichkeit sehr schätze.“

Stets auf dem Laufenden? Die SEQIS Testing-News informieren Sie alle drei Monate über die aktuellsten Entwicklungen im Umfeld Softwarequalität und Softwaretest: Veranstaltungs- und Literaturhinweise, nationale und internationale Neuigkeiten sowie Persönliches runden unseren Newsletter ab. Zu Ihrer Unterhaltung werden Sie immer auch Heiteres in den SEQIS Testing-News finden. Die Anmeldemöglichkeit zum SEQIS Newsletter und die aktuelle Ausgabe finden Sie auf unserer Homepage unter http://www.seqis.com/de/seqis-news/seqis-newsletter.


http://www.SEQIS.com/disclaimer

----- Ursprüngliche Mail ----- Von: "czulehner" reply@reply.github.com An: "klemensl" klemens.loschy@seqis.com Gesendet: Freitag, 14. Oktober 2011 14:12:36 Betreff: Re: [cuke4duke] Step definitions inside jar (#127)

Hi, having the same issue. Neither -r not -j seems to work.

A cumbersome workaround might be to extract the files from the jar into a local directory before execution... any other idea?

TIA Chris

Reply to this email directly or view it on GitHub: https://github.com/cucumber/cuke4duke/issues/127#issuecomment-2405947

czulehner commented 12 years ago

Hi,

good hint!

We're using the SpringFactory, as in the wiki example (https://github.com/cucumber/cuke4duke/wiki/Spring). Together with maven, this works fine for the local steps (in target/test-classes then), but fails for Steps from a jar.

The problem seems to be that cuke does not start the spring context if there ain't a local @StepDefinition class! As in the spring example, the test-classes directory is defined to be --required, so cuke first looks at this directoy for an existing step definition! It seems, that if you don't have a step definition in your local project, cuke won't start spring context and therefor won't scan for definitons in other jars. As mentioned above, providing the jar via --require or --jars did not work.

Solution for me was to include an empty dummy class with a @StepDefinition annotation and provide it via the --require Parameter.

Hope that helps... regards Chris

czulehner commented 12 years ago

PS: Also had to implemented a workaround to update the cuke SpringFactory, so that it adds classes with StepDefinitions-annotation from Spring ApplicationContext.

PPS: Can't just add the bean classes from the applicaiton context, as these classes are (in my example) wrapped by the dynamic proxy and some annotations are not passed through, so I guess cuke has problems to accept the classes as annotated classes. My solution was to parse the class name, skip the proxy extension and add this class to the factory.

Example (pseudocode) : MySteps$$somespringproxy$$classhere => MySteps => addClass(classloader.loadClass(MySteps) )

klemensl commented 12 years ago

good to know that!

Mit freundlichen Gruessen,

Klemens Loschy SEQIS Consulting


SEQIS GmbH - The Austrian Software Test Experts! Neusiedler Straße 36, 2340 Mödling, Austria Telefon: +43 2236 320 320 - 0 Fax: +43 2236 320 320 - 350 mobil: +43 664 TESTS 06 (+43 664 83787 06)

web http://www.SEQIS.com, http://www.KeepLiquid.com


Dr. Bernhard Burger, Manager Quality Assurance, UC4 Software GmbH über SEQIS: „Hohe Qualitätsstandards sowie professionelle Kundenbetreuung zählen zur UC4 Unternehmensphilosophie. Mit SEQIS haben wir einen kompetenten und flexiblen Partner als Unterstützung im Qualitätssicherungsprozess. Für mich zählt dabei vor allem das Vertrauen, das ich in die Partnerschaft mit SEQIS haben kann. Für unser Projekt haben wir einen hochqualifizierten SEQIS Testexperten bei uns im Haus, den ich auch als Persönlichkeit sehr schätze.“

Stets auf dem Laufenden? Die SEQIS Testing-News informieren Sie alle drei Monate über die aktuellsten Entwicklungen im Umfeld Softwarequalität und Softwaretest: Veranstaltungs- und Literaturhinweise, nationale und internationale Neuigkeiten sowie Persönliches runden unseren Newsletter ab. Zu Ihrer Unterhaltung werden Sie immer auch Heiteres in den SEQIS Testing-News finden. Die Anmeldemöglichkeit zum SEQIS Newsletter und die aktuelle Ausgabe finden Sie auf unserer Homepage unter http://www.seqis.com/de/seqis-news/seqis-newsletter.


http://www.SEQIS.com/disclaimer

----- Ursprüngliche Mail ----- Von: "czulehner" reply@reply.github.com An: "klemensl" klemens.loschy@seqis.com Gesendet: Dienstag, 18. Oktober 2011 16:08:52 Betreff: Re: [cuke4duke] Step definitions inside jar (#127)

PS: Also had to implemented a workaround to update the cuke SpringFactory, so that it adds classes with StepDefinitions-annotation from Spring ApplicationContext.

Reply to this email directly or view it on GitHub: https://github.com/cucumber/cuke4duke/issues/127#issuecomment-2442093

klemensl commented 12 years ago

Hi,

could you share you changes? I will switch from pico to spring and would highliy appreciate if you could send me your changes!

thank you, br klemensl

Mit freundlichen Gruessen,

Klemens Loschy SEQIS Consulting


SEQIS GmbH - The Austrian Software Test Experts! Neusiedler Straße 36, 2340 Mödling, Austria Telefon: +43 2236 320 320 - 0 Fax: +43 2236 320 320 - 350 mobil: +43 664 TESTS 06 (+43 664 83787 06)

web http://www.SEQIS.com, http://www.KeepLiquid.com


Dr. Bernhard Burger, Manager Quality Assurance, UC4 Software GmbH über SEQIS: „Hohe Qualitätsstandards sowie professionelle Kundenbetreuung zählen zur UC4 Unternehmensphilosophie. Mit SEQIS haben wir einen kompetenten und flexiblen Partner als Unterstützung im Qualitätssicherungsprozess. Für mich zählt dabei vor allem das Vertrauen, das ich in die Partnerschaft mit SEQIS haben kann. Für unser Projekt haben wir einen hochqualifizierten SEQIS Testexperten bei uns im Haus, den ich auch als Persönlichkeit sehr schätze.“

Stets auf dem Laufenden? Die SEQIS Testing-News informieren Sie alle drei Monate über die aktuellsten Entwicklungen im Umfeld Softwarequalität und Softwaretest: Veranstaltungs- und Literaturhinweise, nationale und internationale Neuigkeiten sowie Persönliches runden unseren Newsletter ab. Zu Ihrer Unterhaltung werden Sie immer auch Heiteres in den SEQIS Testing-News finden. Die Anmeldemöglichkeit zum SEQIS Newsletter und die aktuelle Ausgabe finden Sie auf unserer Homepage unter http://www.seqis.com/de/seqis-news/seqis-newsletter.


http://www.SEQIS.com/disclaimer

----- Ursprüngliche Mail ----- Von: "czulehner" reply@reply.github.com An: "klemensl" klemens.loschy@seqis.com Gesendet: Dienstag, 18. Oktober 2011 16:08:52 Betreff: Re: [cuke4duke] Step definitions inside jar (#127)

PS: Also had to implemented a workaround to update the cuke SpringFactory, so that it adds classes with StepDefinitions-annotation from Spring ApplicationContext.

Reply to this email directly or view it on GitHub: https://github.com/cucumber/cuke4duke/issues/127#issuecomment-2442093