Testing framework for Sinatra
What are some options for testing Sinatra web services? Is RSpec still ideal开发者_C百科? Cucumber? What are some of the current popular tools for testing Sinatra?
It depends on the needs of your project. Ordinarily I think I would lean toward RSpec for testing web services, but I recently had a project where we used cucumber instead. I feel that Cucumber was the right choice for us for a couple of reasons.
First, we wanted acceptance tests which would be approachable by a wide range of team roles. We were actually able to get our business analysts to write the first draft of our features and scenarios, which really gave the developers a nice head start.
Secondly, part of what we needed to test were user-intractable artifacts (emails). So for that part of the end-to-end part of the system we were testing, classic UI-oriented cucumber was a great fit.
I've done some playing around with driving TDD at the unit level with Cucumber. I find that I prefer Rspec for that: Cucumber isn't as flexible as Rspec or other unit-level frameworks.
So I think it kinda depends on the scale, scope and the participants.
精彩评论