Test integration between two rails apps

不打扰是莪最后的温柔 提交于 2019-12-11 03:14:47

问题


I am developing a system composed of two different rails applications (server and client) which communicate via rest web services.

I have tests for each app individually, but I would like to add some test for the integration between the two platforms, to assert that one creates a request compatible with what the other is expecting.

Any hints would be appreciated.


回答1:


I have a similar architecture and we are using VCR in order to record all server side responses and avoid make requests always. It could turn annoying and right now I'm looking for a way to clean data from server after every request

I think VCR could be a good start point in order to test integration between your apps.

You can find documentation here -> Relish Docs




回答2:


I think there could be several approaches here, depending what you have implemented..

  1. If the client Rails app has user interface, try to write Selenium tests to perform the integration test in your local dev environment or a staging environment that has both deployed. (not ideal if the interface is still a prototype, changing frequently...)

  2. Maybe part of the client can be written as a Ruby gem (e.g. the communication rest api is a ruby gem). When the server app in testing environment, the server Rails app can use the Client gem to run integration test, i.e. call the module function, the same function is used by client. The client Rails app can also use the gem to make requests to the server. Here's a good guide to start migrating some of your reusable code to rubygem.



来源:https://stackoverflow.com/questions/10486677/test-integration-between-two-rails-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!