黄瓜和应该的主要区别是什么?

发布于 2024-08-05 03:37:25 字数 75 浏览 2 评论 0原文

如果您要选择一个测试框架,您会如何在 Cucumber 和 Shoulda 之间做出决定?

这两个框架的主要区别是什么?

How would you make a decision between cucumber and shoulda if you were about to choose a testing framework?

What differentiates these two frameworks primarily?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

橙味迷妹 2024-08-12 03:37:25

正如大家所指出的,Cucumber 和 Shoulda 的目标截然不同。您可以将 Cucumber 视为“10,000 英尺处的视图”测试框架 - 您定义广泛的功能或特定的用户交互,并确保一切都能协同工作。应该用于单元测试 - 您选择一个特定的模型并彻底测试该单独部分的所有挑剔的功能。

通常,您会希望结合使用这些类型的框架。例如,大多数广泛的高级测试都可以用 Cucumber 编写,但是当系统中有特别复杂或不透明的代码时,您可以使用 Shoulda 或 RSpec 深入测试细节。

As everybody has pointed out, Cucumber and Shoulda have fairly different objectives. You can think of Cucumber as being the "view from 10,000 feet" testing framework - you define a broad feature or specific user interaction and make sure everything works together. Shoulda is for unit testing - you pick out a specific model and thoroughly test all the picky little bits of functionality for that individual piece.

Usually, you would want to use these sort of frameworks in conjunction. For example, most of your broad, high level tests can be written in Cucumber, but when there's a particularly complex or opaque bit of code in your system, you can drill down with Shoulda or RSpec to test the particulars.

じее 2024-08-12 03:37:25

他们有完全不同的目标。 Shoulda 是一个构建在 Test::Unit 之上的单元测试扩展。

Cucumber 是一个验收/功能测试框架,可以使用 Test::Unit/RSpec/Whatever 进行断言。

例如,Shoulda 可以直接与 RSpec 进行比较。

They have completely different objectives. Shoulda is a unit testing extension built on top of Test::Unit.

Cucumber is a Acceptance/Functional Testing framework that can use Test::Unit/RSpec/Whatever for doing the assertions.

Shoulda can be directly compared to RSpec, for instance.

南风起 2024-08-12 03:37:25

我没有看到其他人提到你实际上可以使用 Shoulda 作为 Cucumber 的“测试引擎”。

I don't see anyone else mentioning that you actually can use Shoulda as the "test-engine" for Cucumber.

国产ˉ祖宗 2024-08-12 03:37:25

Cucumber 的目标是验收测试。
Shoulda 是一个单元测试框架。

Cucumber is targeting Acceptance Testing.
Shoulda is a Unit Testing framework.

蹲在坟头点根烟 2024-08-12 03:37:25

Shoulda 是 Test::Unit 框架的扩展,由测试宏、断言和帮助程序组成。 Shoulda 是一种编写单元测试的更漂亮的方法。

Cucumber - RSpec 的“Story runner”的重写 - 是一个行为驱动开发的工具。它允许您以业务可读的领域特定语言编写可执行规范。 Cucumber 更多的是一种验收测试工具。

因此,Cucumber 和 Shoulda 具有不同的目标(即使 Shoulda 可以用于 BDD)。

Shoulda is an extension of the Test::Unit framework that consists of test macros, assertions, and helpers. Shoulda is a prettier way to write unit tests.

Cucumber - a rewrite of RSpec's "Story runner" - is a tool for Behaviour-Driven Development. It allows you to write executable specifications in a business-readable domain-specific language. Cucumber is more an acceptance testing tool.

Cucumber and Shoulda have thus different objective (even if Shoulda can be used for BDD).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文