diff options
author | Leon Breedt <bitserf@gmail.com> | 2005-03-29 12:31:39 +0000 |
---|---|---|
committer | Leon Breedt <bitserf@gmail.com> | 2005-03-29 12:31:39 +0000 |
commit | b94bd32f3116b469b48400382dbc964bf17994d1 (patch) | |
tree | 91752d7e0f49916e5ed2b9e015815c6dc06b4366 /actionwebservice/README | |
parent | 715715aed443a027fccbac995cd5404eaeabaf53 (diff) | |
download | rails-b94bd32f3116b469b48400382dbc964bf17994d1.tar.gz rails-b94bd32f3116b469b48400382dbc964bf17994d1.tar.bz2 rails-b94bd32f3116b469b48400382dbc964bf17994d1.zip |
first pass of web service scaffolding. add ability to quickly generate an
action pack request for a protocol, add missing log_error when we fail to parse
protocol messages. add RDoc for scaffolding and functional testing.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1037 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/README')
-rw-r--r-- | actionwebservice/README | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/actionwebservice/README b/actionwebservice/README index 1d93bde02f..d6bcea7534 100644 --- a/actionwebservice/README +++ b/actionwebservice/README @@ -197,6 +197,51 @@ For this example, a remote call for a method with a name like method on the <tt>:mt</tt> service. +== Testing your APIs + + +=== Functional testing + +You can perform testing of your APIs by creating a functional test for the +controller dispatching the API, and calling #invoke in the test case to +perform the invocation. + +Example: + + class PersonApiControllerTest < Test::Unit::TestCase + def setup + @controller = PersonController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + def test_add + result = invoke :remove, 1 + assert_equal true, result + end + end + +This example invokes the API method <tt>test</tt>, defined on +the PersonController, and returns the result. + + +=== Scaffolding + +You can also test your APIs with a web browser by attaching scaffolding +to the controller. + +Example: + + class PersonController + web_service_scaffold :invocation + end + +This creates an action named <tt>invocation</tt> on the PersonController. + +Navigating to this action lets you select the method to invoke, supply the parameters, +and view the result of the invocation. + + == Using the client support Action Web Service includes client classes that can use the same API |