cucumber-attic / cucumber-jvm-jython

Cucumber Jython
MIT License
2 stars 5 forks source link

Question: Can we run cucumber-jvm-jython from inside an application #2

Open pabender opened 6 years ago

pabender commented 6 years ago

I contribute to an open source project that has had an embedded jython interpreter included for a number of years.

We recently started adding cucumber tests to our test suite, and I was excited to discover we could use jython to write step definitions.

My hope is to enable users who don't know java, but have been coding in jython for a few years, to add to our test suite. Many of these users are not programmers by training, and only know what they have taught themselves. In an effort to reduce the learning curve for these users, I am trying to figure out if it is possible to 1) trigger cucumber from inside the application itself 2) have the scripts run inside our existing jython interpreter.

I do have Maven, ant, and our JUnit test suite configured to run the small set of features with java step definitions and separately run features with jython step definitions, but I am trying to avoid forcing everyone who wants to tinker with cucumber from installing a development environment.

mpkorstanje commented 6 years ago

Should be possible if you only use python step definitions and if you can configure enough of the system under test throug python.

Btw the core team decided to drop support for cucumber-jython. So this project is looking for a maintainer. If you need anything done we can set you up quite easily.

pabender commented 6 years ago

I'll consider that. It certainly looks like a simple enough project (built on top of the other cucumber-jvm work of course).

A followup question. I see where the backend has two constructors, one that allows the calling method to specify the jython interpreter and one that does not. What I can't figure out is where those constructors are actually called to build the back end.

Right now, I'm looking at Cucumber tests running through the JUnit runner that I want to run inside a pre-configured jython interpreter with some project specific environment bindings that will be used inside of step definitions. (We have java code that sets these bindings when the jython interpreter is created).

pabender commented 6 years ago

Never mind, I found the trigger code inside cucumber-jvm.

mpkorstanje commented 6 years ago

If you want to use the custom interpreter you'll have to create a new runtime instance and add provide it with a backend through a constructor. Or you can patch up the Jython backend to look for the interpreter based on property. The same trick is used for ObjectFactories in the JavaBackend.

Unfortunately no DI yet.

pabender commented 6 years ago

@mpkorstanje

If you could, go ahead and set me up as a maintainer for this project. I'm still a relative neophite when it comes to using cucumber, but I would at least like to see this part of the project keep up with the core.

Thanks!

mpkorstanje commented 6 years ago

@pabender you should be all setup now. Hop onto Slack so I can introduce you to the other commiters.