
Announcing cucumber-electron - theoengland
https://cucumber.io/blog/2017/01/23/announcing-cucumber-electron
======
payne92
Since you work for cucumber, a pro tip: put a summary of what the project is
right up front on the Web page, assuming visitors know nothing.

What is cucumber? What is Electron?

For example: "cucumber-electron is a Javascript module (available via npm)
that combines cucumber, a framework for writing Web page tests in plain
language, with Electron, a framework for building desktop apps using Web
technologies. ..."

------
stu_k
The title is slightly misleading. This just looks like an alternative way to
run Cucumber, not a complete alternative to Selenium.

~~~
yebyen
It didn't even occur to me that there were other ways of using Selenium than
Selenium-WebDriver!

~~~
joshski
This is not an alternative way of using selenium. It's a way to avoid using
selenium. The advantage over selenium is that tests and application code are
run in the same process, so they tend to be faster, less brittle and easier to
debug. The downside is that they are not cross-browser.

~~~
yebyen
There are also other ways of using Selenium, though, that I had mentally
disregarded and ignored as probably not useful.

You can also get this behavior (basically single thread of execution) with
cucumber-rails and Selenium (or probably any driver other than Selenium, for
that matter). I'm not saying the application code is literally run in the same
thread or process as the test executor, but in effect they do. Your Ruby
process is in charge of setting up the HTTP server, as well as driving
whatever driver (Selenium, Phantom, ...) you're using for Cucumber.

So serendipitously, with (MRI) Ruby being a single-threaded beast, you do
still get that behavior and quality of being able to catch errors that pop up
on either side, making it much easier to debug misbehaving server or tests.

------
yebyen
This sounds very interesting. I have been using cucumber in my development
with Selenium WebDriver (cucumber-rails) and the author here has promised
things that were missing in PhantomJS and Capybara-WebKit that drove me toward
using Selenium and Chrome instead. Namely the option of running in either
Headed mode with the inspector available, or Headless.

Does this project require your system-under-test to be a pure Node.Js
application to work with it? (I am not sure if I had heard of electron, but it
looks to be the case.) Is there any possibility of porting this to be a driver
for test systems that use Cucumber for systems built in other languages?

~~~
joshski
Yes you can use it to describe and automate systems built in other
technologies and I've done that on a couple of projects. It's a good fit for
any web app with a lot of client-side code. But its sweet spot is definitely
node.js apps.

You could certainly use electron as a driver for tests written in other tech,
but there is no capybara electron driver that I'm aware of. Using cucumber-
electron means you write your step definitions (automation code) in
JavaScript.

(I'm the author of cucumber-electron)

~~~
yebyen
Thanks for showing up and answering questions!

I've gotten used to having my rails application (server) running in the same
thread as my cucumber (client-side) steps, thanks to cucumber-rails. So I
could see why this would be especially useful for testing node.js
applications, with the same advantages. (A fault detected anywhere on either
side of the test execution, client or server, can be escalated and reported to
stop the entire test, delivering a really good, clear idea of where to look in
the code for the violator!)

This looks like a really neat project.

------
cookiesboxcar
whats the best headless browser for CI/CD? I've always used Phantom, but would
be keen to explore alternatives (especially if it could quiet the "nobody uses
phantom in real life")

~~~
cyrusroshan
I write tests using chromedriver. Ends up being really simple to write, and if
I want to debug something, it's just a chrome instance that I can use normally
if I make the tests wait.

Only downside is you have to make it run with xvfb on the CI server, but
that's pretty easy to set up in your config file usually.

~~~
SigmundA
Is headless Chrome working yet?

[https://chromium.googlesource.com/chromium/src/+/lkgr/headle...](https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md)

~~~
fake-name
It works, but there are a number of issues in the remote control protocol.

(note: I am developing a python wrapper for controlling it:
[https://github.com/fake-name/ChromeController](https://github.com/fake-
name/ChromeController) )

I've been meaning to see about wrapping the C++ api as a python module, but
not had time.

------
twolfson
I wrote something similar to this but 1 level higher by using Karma. It's
called `karma-electron` and it allows you to use any test framework inside of
Electron as well as any other launcher Karma supports (e.g. Firefox, Chrome,
PhantomJS):

[https://github.com/twolfson/karma-
electron](https://github.com/twolfson/karma-electron)

------
seanwilson
Can anyone explain why you would want to use Cucumber? I heard it enables non-
programmers to write the tests themselves but I don't see that as realistic as
non-programmers don't have the training to specify requirements rigourously.
At least with coded tests you can use IDEs to validate and refactor your
tests.

~~~
rukenshia
We use cucumber at work for a few weeks now. Our product owner actually writes
the initial feature files for our end-to-end tests and we refine them. We keep
sending him back on what we changed and why, and the product owner learns from
that and tries to do it the next time. We started doing this around 6 weeks
ago and it is helping us developers a lot in my opinion, as well as getting
some work off of us. Sure, we need to refine the POs feature definitions, but
it's better than nothing.

~~~
jedifans
Before the feature files get written, have a conversation with the PO and
other stakeholders.

Involve a QA person and relevant developers.

Catch the changes early, ask for more examples of the feature or goal, "have
you thought about ...", "What happens in this case...?".

You will get better quality features with less rework, because you are writing
the thing the PO actually wants and cover off edge cases before they crop up
in testing.

------
imranq
wow I actually thought someone had discovered some ridiculous orbital pathway

------
ape4
Pretty soon no word will have its original meaning. An electron is not a
subatomic particle. A cucumber isn't a veggie. Rust isn't...

~~~
rjeli
Perhaps we should take a hint from Urbit and start naming our projects Zog-
wip-let-bon, etc.

~~~
pjc50
The pharmaceutical industry has an entire sub-industry of coming up with names
- I believe there's an algorithm for producing phonetically reasonable names
that are unique.

[http://www.popsci.com/science/article/2013-04/fyi-how-
does-d...](http://www.popsci.com/science/article/2013-04/fyi-how-does-drug-
get-its-name)

