[英]Javascript client framework with Rails JSON API - how to do integration tests?
I have two applications, a Rails JSON API, and a Javascript client framework. 我有两个应用程序,一个是Rails JSON API,另一个是Javascript客户端框架。
What is the best way to do integration tests ? 进行集成测试的最佳方法是什么?
And another question, can this be done via Capybara ? 另一个问题,这可以通过Capybara完成吗?
If you want a true integration test, you can use Capybara with a driver that executes javascript, like Poltergeist , or Capybara-Webkit . 如果你想要一个真正的集成测试,你可以使用Capybara与执行javascript的驱动程序,如Poltergeist或Capybara-Webkit 。 Alternatively, you could use Selenium, but that's not quite as slick as a headless test. 或者,您可以使用Selenium,但这并不像无头测试那样光滑。
That said, you will probably have a lot more luck and more solid tests if you test your front end and back end separately with Rspec on the back and Jasmine/Qunit on the front. 也就是说,如果你分别用背面的Rspec和前面的Jasmine / Qunit测试你的前端和后端,你可能会有更多的运气和更坚实的测试。 Integration tests with JS are often tricky. 使用JS进行集成测试通常很棘手。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.