I have a question regarding mashup development. I am currently
developing a google mashup application and am wondering how to test
its functionality. I am not sure if I can communicate with the google
calendar and actually input information into the calendar while in
development mode. Does anyone know how to do this? Do I actually
need to launch the site in order to test the integrative
functionality. Thanks, Dave
Don’t know, if that’s some help to you.
I developed a site with payment functionality once.
The payment stuff was done with some simple interface
which returned html. For development we used the test
server of the payment provider, but didn’t want to do this
for the tests.
Since we’re using rspec for testing, it was quite easy to
fake this:
Basket.stub!
(:new_payment_cluster).with(baskets(:thorsten_payment)).and_return(open(File.dirname(FILE)
- “/…/fixtures/tdps_response/new_payment_cluster_success.xml”).read)
This line stubs the new_payment_cluster of the basket model (our
shopping cart)
Instead of retrieving the xml response from the server and handing it
back to the calling
function it’ll now use a local xml file.
Another use case:
[‘paid’, ‘closed_success’].each do |partial_payment_state|
response_xml = ERB.new(open(File.dirname(FILE) + “/…/fixtures/
tdps_response/new_partial_payment.erb.xml”).read).result(binding)
Basket.stub!
(:start_partial_payment).with(baskets(:thorsten_payment)).and_return(response_xml)
This takes a xml erb file and replaces parts of it with erb. So I was
able to use a single xml file to fake several possible responses and
test against the start_partial_payment method to see if the system
works with those response types (which could be a success or some
error codes.
So the general idea for rspec is to stub all the methods that
communicate
with the outer world and use some local fixture data as response. Not
necessarily a xml file as used here, this could be simple strings or
some
other methods you provide