Velocity and CI


#1

For those with meteor apps in production, what testing combinations are you using with velocity for TDD/BDD?

Anyone using cucumber yet?


#2

For testing TDD/BDD, I am following “The Meteor Testing Manual” http://www.meteortesting.com/ . The book is making use of Cucumber and Jasmine to cover all aspects of testing (but it is not yet complete).

As for real live projects, I have tried myself Cucumber, but I was running on a lot of issues with defining steps, especially on WebdriverIO calls like waitForExist / waitForVisible in combination with Iron Router redirects. As for myself, I am still waiting for the Meteor testing frameworks to mature a bit and have better documented usage examples to appear and follow.

I am also curious if anyone else had better success with TDD/BDD and Meteor.


#3

Josh Ownes did some work on this. You can check this: http://joshowens.me/cucumber-js-and-meteor-the-why-and-how-of-it/


#4

I agree… @bojicas I have been playing around with Cucumberjs & have been running into problems with fixtures, tags and in general defining the steps… I am making some progress, but every test i write, its taking a lot of time to figure out the issues. I also find that after a few tries, I get connection timeouts to the mirror. Not ideal, but its a good first step…

i really like the browser based testing that is possible with that package.


#5

thanks all for the feedback and tips. i like the promise of cucumber (maybe more the gherkin part). right now i feel good with either nightwatch (via velocity, https://github.com/awatson1978/clinical-nightwatch) or using zombie (non-velocity, https://github.com/jdlnolen/ztest).


#6

Hy!

If you are starting with cucumber-js, please take a look at this lib: https://github.com/hackhat/cucumberry

Is Cucumber-js with sync, callable steps and parsed arguments. This works with cucumber and doesn’t replace it.

Hope you find it useful (:


#7

I guess I’d better chip in, I’m the author of cucumber and I’m using it in my own app now. The perspective between using it and writing it is quite different I’ll say that much :smile:

Sorry to hear you’re having some trouble @sunkay, I’ve seen your tickets on GitHub. I’m getting to them I promise!

The latest version of xovlio:cucumber now has Chai baked so you can do “something”.should.have(“thing”) and I’m trying to monkey patch it to support chai-as-promised. I’m also creating a much tighter integration with xolvio:webdriver, which includes additional Meteor specifics like waiting for iron router (thanks to Sanjo’s recent work in that area).

I’m using cucumber in my own app that constantly runs locally and on codeship and so far it’s been pretty stable. I’ll get CI for Letterpress soon to demonstrate this (or maybe @joshowens will ;))


#8

@hackhat…thanks…i will take a look…

@sam…thanks for that. and maybe joshowens :wink:


#9

Interesting, I’ve got a small app in “production” and had been looking around for some sort of integration/browser testing to move beyond the tdd/bdd provided by velocity.

Is there a reason why this thread is leaning cucumber over some of the other alternatives out there, like casperjs? (I’ve never used cucumber, so I apologize in advance if these two libraries are not at all related).


#10

@gojira…i am interested in cucumber for the BDD/gherkin angle. at the end of it all, i just need a decent suite of tests to cover the code (unit, integration, e2e) to give me and team peace of mind in production.

@sam…would you mind sharing your CI setup for codeship that is working for you with cucumber? My cucumber tests work great locally but hang at this step:

=> App running at: http://localhost:3000/
I20150227-13:54:50.209(0)? [xolvio:cucumber] Cucumber is running

thx…


#11

Better yet, wait for the next version of webdriver and cucumber out this weekend (hopefully today) and you’ll be able to use your script as is


#12

@gojira

Cucumber gives you a powerful way to describe you requirements in the business language. That’s what it’s good at. It can drive whatever browser automation technology you choose. I personally chose webdriver + phantom because of the widely used selenium protocol (saucelabs / browserstack) and the speed of phantom for local development. There are people that use cucumber with zombie


#13

@jdlnolen I just released
xolvio:cucumber@0.5.2
xolvio:webdriver@0.4.0

If you update to these, the codeship build should work. The reason it was freezing was because phantomjs was missing/not correct and now webdriver uses Meteor’s phantomjs

Be careful that codeship doesn’t downgrade the packages when it runs (it does that for some reason). If it does, be sure to pin the versions above in your .meteor/packages file


#14

@sam thanks for the webdriver update! I have things working on travis with cucumber!

Now for codeship…anyone else getting this error?

=> Errors prevented startup:
While building the application:
node_modules/chromedriver/node_modules/npmconf/node_modules/nopt/bin/nopt.js:1:15:
Unexpected token ILLEGAL
node_modules/chromedriver/node_modules/npmconf/node_modules/nopt/examples/my-program.js:1:15:
Unexpected token ILLEGAL
=> Your application has errors. Waiting for file change.

My codeship commands are below:

setup commands:

nvm install 0.10.33
nvm use 0.10.33
curl -o meteor_install_script.sh https://install.meteor.com/
chmod +x meteor_install_script.sh
sed -i “s/type sudo >/dev/null 2>&1/\ false /g” meteor_install_script.sh
./meteor_install_script.sh
export PATH=$PATH:~/.meteor/

test commands:

meteor --test


#15

Sorry, my bad! Try again with 0.5.2 :slight_smile:


#16

That’s xolvio:webdriver 0.5.2


#17

@sam thanks for the fix. between that and tweaking of the setup commands, codeship is working…

FWIW, the illegal token errors i think were due to shebangs in some sample code in the nopt package. between reseting the cache and running a command like this in the setup to remove it, it went away…

echo “$(tail -n +2 node_modules/chromedriver/node_modules/npmconf/node_modules/nopt/examples/my-program.js)” > node_modules/chromedriver/node_modules/npmconf/node_modules/nopt/examples/my-program.js


#18

great to hear and thanks for letting us know

You’ll notice that builds on codeship sometimes just downgrade packages, which baffles me! Not sure if it’s linux / contraint resolver / other


#19

@sam it’s a bug in the constraint solver.
Use meteor refresh just after you’ve installed Meteor on codeship.
That’ll update the package catalog. A real fix for this also coming with the next release.

see: https://github.com/meteor/meteor/issues/3653


#20

Aha! Thanks man, that’s much better to do than what I’m currently doing, which is pinning versions in my package file!