I've deployed an app to Heroku, and it all works fine. The problem is I can't get my unit tests running remotely. I've tried:
heroku rake test:units
and
heroku rake db:test:prepare
but for both I get a massive stack trace, ending with:
rake aborted!
undefined method `[]' for nil:NilClass
/app/[id]/home/.bundle/gems/ruby/1.9.1/gems/activerecord-3.0.3/lib/active_record/railties/databases.rake:429:in `block (3 levels) in <top (required)>'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:634:in `call'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:629:in `each'
/usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:629:in `execute'
I'm running the bamboo-mri-1.9.2
stack.
The closest I've got to an answer so far is this blog post from 2009.
Heroku doesn't provide a testing database, so there's no straightforward way to do that. You could theoretically create a new heroku instance and hack up the rake tasks to just use the 'production' database possibly, but I doubt the effort required would be worth it.
Heroku devcenter provides an explanation about how managing a staging environment here : http://devcenter.heroku.com/articles/multiple-environments
I don't know if it possible to run unit tests but I perfectly understand why you want to do this.
Your Heroku application:
You can test all that with a staging environment but we could say that for every unit test, so I think it would be great if we could run unit test on Heroku.
The normal way is to do the testing locally, then deploy to a hidden Heroku instance ("staging"). Then you can test that hidden staging app with your beta testers, run stress tests on it and so on. If you are satisfied with it, deploy your app to your "production" Heroku instance.
So testing on Heroku is possible and usual, but not with unit tests.
Heroku does not have the test suite, you really should be testing on development side before deployment to heroku.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With