Hi, I am new to RSpec and BDD. I was wondering if RSpec specifications are a good solution for testing REST webservices (not implemented in Rails). If so, what would be a good way to test something like the API described below? ========== GET http://localhost/workflow text/xml Result: 200 OK <?xml version="1.0"?> <workflows> <workflow>flow1</workflow> <workflow>flow2</workflow> <workflow>flow3</workflow> </workflows> POST http://localhost/workflow?name=flow4 text/xml Data: <?xml version="1.0"?> <workflow> <monitor type="page" priority="0"> <provides result="test"/> </monitor> <process command="test" id="test" weight="100"> <needs result="test"/> <provides result="test_result"/> <error result="error"/> </process> </workflow> Result: 201 Created GET http://localhost/workflow text/xml Result: 200 OK <?xml version="1.0"?> <workflows> <workflow>flow1</workflow> <workflow>flow2</workflow> <workflow>flow3</workflow> <workflow>flow4</workflow> </workflows> GET http://localhost/workflow/flow4 text/xml Result: 200 OK <?xml version="1.0"?> <workflow> <monitor type="page" priority="0"> <provides result="test"/> </monitor> <process command="test" id="test" weight="100"> <needs result="test"/> <provides result="test_result"/> <error result="error"/> </process> </workflow> DELETE http://localhost/workflow/flow3 Result: 204 No Content GET http://localhost/workflow text/xml Result: 200 OK <?xml version="1.0"?> <workflows> <workflow>flow1</workflow> <workflow>flow2</workflow> <workflow>flow4</workflow> </workflows> ==== TIA, Erik.
On 21 May 2008, at 21:37, Erik Terpstra wrote:> I am new to RSpec and BDD. > I was wondering if RSpec specifications are a good solution for > testing REST webservices (not implemented in Rails). > If so, what would be a good way to test something like the API > described below?Hi Erik RSpec would be fine to test that, it''s just a web app returning XML instead of HTML. You don''t say what you are building the web service in. If you want acceptance/integration-style specs that are implementation-independent, you could use the story runner with steps to make HTTP requests. And look at Kyle''s rspec_hpricot_matchers for a way of specifying XML output. You will also want unit specs for your models, controllers etc which will be more framework-dependent. That''s all I can offer based on your description. Ashley -- http://www.patchspace.co.uk/ http://aviewfromafar.net/
Seemingly Similar Threads
- RSpec for testing REST webservices? (Not Rails)
- [StructurizeCFG] Trouble with branches out of a loop
- should have_tag outside Rails
- Samba shows error NT Status: STATUS_OBJECT_NAME_NOT_FOUND when copying 10GB file using robocopy when ecryptfs file system shared using samba
- Samba shows error NT Status: STATUS_OBJECT_NAME_NOT_FOUND when copying 10GB file using robocopy when ecryptfs file system shared using samba