Announcing Cucumber v0.8.0
meteor add xolvio:cucumber
This updated has taken over 2 months of work to complete and is built from the ground up on the lessons learnt from working with clients, working with the community, writing The Meteor Testing Manual and working on our own startup.
It’s built on top of the rock-solid Velocity 0.6 and sports the following features:
Fluent Syntax
You now have a fluent syntax using promises that allows you to write concise and clean readable code inside your steps like this:
return this.browser.
click.('.this-class').
getText('.that-class').should.become(title)
Notice there are no callbacks! This is because I’ve baked-in WebdriverIO’s promises with Chai-as-promised into steps as well as promisifying CucumberJS. You can still use callbacks if you need to of course.
Streamlined Meteor-Style Development Mode
Many said it doesn’t make sense to run end-to-end tests on save whilst developing like everything else in Meteor. Well I beg to differ! This update will only run scenarios that you tag with @dev
in your feature files. This means you can focus on building your app one scenario at a time, and on the CI server all the scenarios will run (unless you @ignore
them of course).
Pre-Wired DDP Connection
In the step definitions, you now have access to a ddp connection that allows you to call methods on the mirror. This is invaluable in allowing you to setup test data with simple calls like:
this.mirror.call('setup-users', 'tom', 'jim')
// or
this.mirror.apply('setup-users', ['tom', 'jim'])
Real Browsers with Session Reuse
You can now choose any browser by running SELENIUM_BROWSER=chrome meteor
. This will use chrome instead of the default phantomjs
. You can of course also use firefox
or safari
and even iexplorer
. When you usually use a real browser, you get an annoying flickering of windows appearing and resizing. Not with this package! Your browser window will stay open and will get reused throughout your development session. And don’t worry about not having Selenium, this package will auto download everything for you.
SauceLabs / BrowserStack / Selenium Grid Support
Want to test on a variety of browsers? No problem! You just enter your host address along with a few other details and you’re all set. See here for instructions.
Slick console reporting
The latest Velocity logging update means you can now tail the cucumber logs separately to other frameworks and the main app. This means as your steps run, you can keep your eye on the console and get detailed feedback. This package now cleans up the logs by allowing you to copy/paste auto-generated step snippets without timestamps and you even get fancy colors for clarity.
Screenshots on Errors
When a test fails, you need all the info you can get. So in addition to the detailed console reporting, you also get a screenshot when something goes wrong. This is especially useful when you’re using chrome, or running on CI. If you don’t like the default output directory, you can customize it.
Not Just Meteor
Whilst xolvio:cucumber
is a meteor package, it uses cuke-monkey
under the covers, which is built for use in any platform where users wish to use cucumber. If you’re interested in, check out the Github repository.
Breaking changes
All of the above came at a little price of some breaking changes. If you are on a version < 0.6.0, please be sure to follow these migration instructions.
All of the above are now out-of-the-box, just upgrade and let us know what you think. Please report any issues that you find on the GitHub issue page.
Next
The super fast parallel testing work is being done as you read this so expect that update soon. If you don’t know what htis is, you should check out the devshop presentation Mike Risse and I did about it here.