Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.

Improve tests #37

Open
mulderp opened this issue Apr 1, 2013 · 6 comments
Open

Improve tests #37

mulderp opened this issue Apr 1, 2013 · 6 comments

Comments

@mulderp
Copy link
Contributor

mulderp commented Apr 1, 2013

Hi,

I wanted to ping whether there are needs to improve the tests for this project. Some issues/ideas:

  • add integration tests with e.g. cucumber or capybara
  • split test setups into different files
  • use helper scripts for different frameworks
  • make smaller tests/files
  • move to another test framework (?)

What do you think, am I missing something, or confusing?

Thanks for feedback evt.

Patrick

@assaf
Copy link
Owner

assaf commented Apr 2, 2013

What are the issues with the tests?

@mulderp
Copy link
Contributor Author

mulderp commented Apr 2, 2013

I find running the tests not so easy, i.e. I was exploring how to make this project run with an SQL orm adapter (see https://github.com/mulderp/rack-oauth2-server/tree/active_record )

However, as far as I can see:

  1. It is difficult to run tests that would just concern the ORM adapter, the finest test granularity to run is e.g. with

    ruby -I . test/oauth/access_grant_test.rb -n "/using authorization code should response with sc/"

  2. The setup of a test is not clear to me, e.g. I get with my SQLLite:

  1) Error:
test: using authorization code should response with scope. (AccessGrantTest):
URI::InvalidURIError: bad URI(is not URI?):
    test/oauth/access_grant_test.rb:71:in `setup'
    /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/testing/setup_and_teardown.rb:36:in `block in run'
    /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:425:in `_run__1710559639028385245__setup__3451353526551626419__callbacks'
    /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
    /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_setup_callbacks'
    /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
    /Users/pmu/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/testing/setup_and_teardown.rb:35:in `run'

It is not clear to me, where/what initial values to set here.

That is why I was thinking before taking the larger step of introducing an ActiveRecord setup, it would be interesting to me, to learn more on the test setups, evt. start with some small improvements, to get going.

@mulderp
Copy link
Contributor Author

mulderp commented Apr 6, 2013

Another issue is upgrading Shoulda, since it includes a broken version of Mocha, if I see correctly :https://github.com/freerange/mocha

Versions 0.10.2, 0.10.3 & 0.11.0 of the Mocha gem were broken

@assaf
Copy link
Owner

assaf commented Apr 8, 2013

I don't see where Shoulda requires Mocha.

@mulderp
Copy link
Contributor Author

mulderp commented Apr 8, 2013

Hmm.. I think the problem is shoulda-matchers, requiring bourne:

shoulda-matchers (1.4.2)
  activesupport (>= 3.0.0)
  bourne (~> 1.1.2)

And bourne requires an old Mocha version. But indeed it's possible to work with it, but somehow it gave problems to my test setup. I'll check currently how to upgrade the setup.

@repomaa
Copy link

repomaa commented Apr 8, 2015

I forked the repo and I'm working on porting the gem for mongo 2.0. Now I'm running the tests for well over 3 hours already. This surely isn't normal, is it? The framework it's testing with is sinatra. Any ideas of how to speed up the tests?

I know that devise sets special params for the crypto in test environment. Maybe the token generation is the bottle neck. CPU usage is at 100% constantly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants