本文介绍了菠菜对黄瓜BDD在rails的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从BDD开始。想知道哪个是更好的开始与黄瓜或菠菜。我的印象是菠菜是新的块。查看 p>

我应该从哪一个开始。标准为


  1. 全面支持

  2. 灵活使用

  3. 第三方工具和API集成。

再次,这可能是新手的无知问题:capybara

解决方案

对于某些上下文,我一直是黄瓜的长期用户,但总是希望它是菠菜从第一天。我把所有我的项目切换到Spinach尽管它的缺点,因为它使用新的,热关闭块PORO技术(普通老Ruby对象;)。



为了回答你的问题,在写这篇文章时:


$ b现在我可以扩展我的步骤了,因为它只是Ruby。 $ b

Cucumber



Spinach仍在开发一些功能,包括Background块,我目前正试图让它识别表。 >

Spinach



Cucumber从一开始就鼓励不良步骤设计。如果您创建特定于功能的步骤,您将在以后跳过它们,如果您创建可重复使用的全局步骤,您的功能定义将很长,通用和无聊。我听说有人声称他们能够成功地取得平衡,只有足够的具体,但仍然有可重复使用的步骤;

Cucumber,假设项目符号可以解释为社区。 p>

如果它真的是第三方工具和API集成,你就是后来,Spinach支持capybara和rspec,这是你的大多数。黄瓜有第三方可重复使用的步骤库,但正如我之前提到的,我认为这是坏的。关于第三方&

Capybara是您网站的测试介面,键盘。你可以在控制台启动它,并驱动你的应用程序,但这会得到重复。 Cucumber / Spinach(或rspec / test-unit / minitest)都可以使用capybara来自动测试你的应用程序。人们喜欢Cucumber / Spinach,因为他们帮助你跳出代码,有点像用户一样思考。






,你可能最好是得到一个rspec /黄瓜书,做它说的话。只要知道测试需要一段时间才能得到好处,所以不要停止。也许在过程中的某个地方检查菠菜;如果你喜欢Cucumber,你可能会发现你真的喜欢Spinach。


I am starting on BDD. Was wondering which would be better to start with Cucumber or Spinach. My impression is that Spinach is new off the block. Look here

Which one should I start with. The criteria would be -

  1. Support across the board.
  2. Flexibility of use
  3. Third party tool and APIs integration.

Again it might be ignorant question of the newbie: Where does capybara fit into the picture.

解决方案

For some context, I've been a long time user of Cucumber, but always wished it was Spinach since day one. I'm switching all my projects to Spinach despite its shortcomings because it uses the new, hot-off-the-block PORO technique (Plain Old Ruby Objects ;). Now I can expand my steps however I want, because it's just Ruby.

To answer your question, as of this writing:

Cucumber

Spinach is still developing some features, including 'Background' blocks, and I'm currently trying to get it to recognize tables.

Spinach

Cucumber encourages bad step design from the start, IMO. If you create feature-specific steps, you'll trip over them later, and if you create reusable global steps, your feature definitions will be long, generic, and boring to read. I've heard people claim they can walk a balance successfully and be just specific enough but still have reusable steps; I consider myself well versed enough that if I can't do it reliably, it's too hard.

Cucumber, assuming the bullet point could be interpreted as community.

If it's really "third party tools and API integration" you're after, Spinach supports capybara and rspec, which is most of what you're after. Cucumber has 3rd party reusable step libraries, but as noted in my earlier point, I think this is bad. In regard to 3rd party & integrations, even if it's not there yet, your really can't get any better than plain old ruby objects.

Capybara is your test interface to your site, aka a testing mouse & keyboard. You could start it up in a console and drive your app, but that'd get repetitive. Cucumber/Spinach (or rspec/test-unit/minitest) all could use capybara to automate testing your app. People prefer Cucumber/Spinach because they help you step out of the code for a bit to think like a user.


Overall, you'd probably be best off getting an rspec/cucumber book and doing what it says. Just be aware that testing takes a while to get good at, so don't stop there. Maybe check out Spinach somewhere in the process; if you like Cucumber, you might find you'll really like Spinach.

这篇关于菠菜对黄瓜BDD在rails的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 11:17