开发者

Cucumber vs. built-in testing? [Rails]

开发者 https://www.devze.com 2022-12-23 09:33 出处:网络
I asked a question about different testing frameworks yesterday. This question can be found here. Now that I have a better understanding of the different frameworks, I have a very simple question:

I asked a question about different testing frameworks yesterday. This question can be found here. Now that I have a better understanding of the different frameworks, I have a very simple question:

With a basic understanding, but very limited experience with writing tests with rails' built in testing framework (basic assertions), would it be okay for me to jump directly to testing with RSpec, Webrat, and Cucumber开发者_如何学编程?

Thank you!


As a side note: yes, this is an opinion based question, but I feel that the input received to this question is valuable enough to the community to keep this question open. Thanks.


I never wrote a lot of tests with the build in testing framework, but jumped right in to use Cucumber with factory girl and RSpec and am VERY happy with it. I find it very easy to describe features I want to work on in Cucumber first. I always had trouble getting myself to write Unit tests first.

So from my personal experience, I can encourage you to jump right into the fun stuff!


Using other testing framework, you can write test easier and easier to maintain, some test frameworks build-in "macro" is very helpful. And what's more you can extend these testing framework like shoulda you can write your own "macro". Using cucumber like BDD framework, you can write clean integration test. You can even tell your BA how to run it. it will helpful to your tester too.

Now what we use is shoulda, rr mock, cucumber + selenium


Cucumber is for behavior, e.g. integration tests. Test::Unit and Rspec are more appropriate for unit tests that test the code. It's well worth spending a few hours reading up on unit, integration, and acceptance testing to understand the different purposes of each kind of test. This is a big field and it's a good investment.

Once you've done that, yes, by all means jump in with Rspec and Cucumber. You might also look at Turnip. For JavaScript, consider Capybara.

0

精彩评论

暂无评论...
验证码 换一张
取 消