0
I’m having the following doubt, I’m making a web-service server with my application ruby-on-Rails, I’m using the gem wash-out
, I understood how it works and I was able to put my web-service to run, but I would like to know how to test my server, I’ve searched several tutorials and none helped me.
For example:
soap_action "novo_cadastro",
:args => {:titulo => :string, :descricao => :string },
:return => :xml
def novo_cadastro
cad = Cadastro.new(titulo: params[:titulo], descricao: params[:descricao])
if cad.save
render xml: cad
else
render :soap => nil
end
end
How to test this?
Grateful.
what kind of test you are in doubt of how to do unit test or integration test?
– Felipe Bergamo
I have my controller working, I created a client and it only connects, makes requests and gets a response, but this was just a test, on my real server, I need to use the TDD technique to make sure that it is working, I can’t test the actions of the controller, I don’t really know how, the client is easy to test, but and the server?
– Anderson Pierok
start by running unit tests on your server, the secret to a good test is to cover as much of the code as possible and test your program’s boundary cases well, start by breaking your program into small tests in a simple way. Test has no miracle, have q stop studying and do. I suggest if you are in a hurry the codeschool test courses.
– Felipe Bergamo
@Felipebergamo I know how to do tests, the model is with 100% test coverage, my question is how to test this function above, which is only accessed by a client.
– Anderson Pierok
like the
wash-out
is based on GemSavon
, take a look at Gem: savon_spec– danilopopeye