From b94bd32f3116b469b48400382dbc964bf17994d1 Mon Sep 17 00:00:00 2001 From: Leon Breedt Date: Tue, 29 Mar 2005 12:31:39 +0000 Subject: 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 --- actionwebservice/README | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'actionwebservice/README') 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 :mt 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 test, 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 invocation 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 -- cgit v1.2.3