Strange web service testing problems

I seem to be having some strange problems with functionally testing web
services.

For some reason when I assert_routing of a web service called test with
a method test:

options = {:controller => “test”, :action => “test”}
assert_routing “test/test”, options

all is fine.

But once I invoke the method test from my test class I get a routing
error.

require File.dirname(FILE) + ‘/…/test_helper’
require ‘test_controller’

class TestController; def rescue_action(e) raise e end; end

class TestControllerApiTest < Test::Unit::TestCase
def setup
@controller = TestController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end

passes

def test_routing
options = {:controller => “test”, :action => “test”}
assert_routing “test/test”, options
end

routing error

def test_test
invoke :test
end
end

and here is the error:

Loaded suite test/functional/test_api_test
Started
.E
Finished in 0.062193 seconds.

  1. Error:
    test_test(TestControllerApiTest):
    ActionController::RoutingError: Need controller and action!
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/routing.rb:1256:in
    generate' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/url_rewriter.rb:104:inrewrite_path’
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/url_rewriter.rb:69:in
    rewrite' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:522:inurl_for’
    /Users/mbrio/Documents/Source/livegames-network/config/…/app/controllers/application.rb:93:in
    remember_location' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:456:insend’
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:456:in
    call' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:450:incall’
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:637:in
    call_filter' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:638:incall_filter’
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:449:in
    call' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:637:incall_filter’
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:619:in
    perform_action_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:66:inperform_action_without_rescue’
    /usr/local/lib/ruby/1.8/benchmark.rb:293:in measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:66:inperform_action_without_rescue’
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:83:in
    perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:insend’
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:430:in
    process_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:inprocess_without_session_management_support’
    /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/session_management.rb:114:in
    process_without_test' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/test_process.rb:15:inprocess’
    /usr/local/lib/ruby/gems/1.8/gems/actionwebservice-1.2.3/lib/action_web_service/test_invoke.rb:10:in
    invoke' test/functional/test_api_test.rb:19:intest_test’

Any help would be greatly appreciated.

Michael,

If you are interested in a utility to test your web service, I would
suggest DigitForge’s Visual Web Service Client application.
Completely eliminate the need to develop test harnesses, unless of
course that is a requirement :slight_smile:

DigitForge: http://www.digitforge.com.

VWS has a free trial that you can download to test against your web
service. Can also check out the movie here:
http://digitforge.com/downloads/vwsoverview.wvx
.

Hope that helps.