验收测试与单元测试示例

发布于 2024-11-19 19:07:12 字数 582 浏览 1 评论 0原文

好的,所以我一直在尝试查看有关测试、不同测试库等的信息。

在我看来,人们总是明确地将这些测试的区别定义为高水平和低水平。并且经过正确测试的应用程序将包含样式测试以及集成测试等。

但似乎每一篇关于测试类型的文章都以“在实践中很难看出实际差异是什么”结尾。 ”。我觉得很奇怪的是,人们似乎如此说教,以至于你必须同时进行测试才能达到任何类型的完整代码覆盖率,同时又没有任何关于每个测试可能是什么样子的好的信息/示例。

我这么问是因为我正在开始一个新项目,这个项目有望比我过去所做的任何事情都更大、更投入。我希望在测试中保持良好的工作流程,并确保我不会在测试中产生间隙(在过去的项目中,间隙很小,我可能存在的任何间隙似乎都不会导致任何重大问题)在生产中这并不简单 t0 正确)

我知道这似乎是一个很好的验收测试,自然会引导您进行单元测试,一旦您得到它,就会发生这种神奇的事情,您的开发生活也会更加幸福。

不管怎样,有谁知道关于开始良好的测试工作流程的任何好的讨论,其中讨论了在验收/集成测试到单元测试之间的转换。

.net 的例子会很棒,但由于大多数测试框架 cucumber(gherkin)/rspec 等都意味着具有相当的可读性,因此任何示例都应该很好。

OK, so I have been trying to look at information on testing, different testing libraries what not and so forth.

It seems to me that people always clearly define the difference of these test as one being high level and one being low level. And that a properly tested out application would contain both style tests as well as integration test, etc. etc.

But it seems like every article about the test types ends with something like "in practice it could be hard to see what the difference actually is". I find it weird that people seem so preachy that you must have both test to even reach any sort of full code coverage and at the same time not have any good info/examples on what each might look like.

I am asking because I am starting a new project, that promises to be much bigger and more involved than anything i have done in the past. I would like to keep a good workflow with my test and make sure I am not creating gaps in my testing as I go (in the past projects have been small, and any gaps I might have had don't seem to cause any major issues in production that weren't simple t0 correct)

I know that it seems a good Acceptance Test, naturally leads you to your unit test and once you get it, it is this magical thing that happens and your development life because just that much more blissful.

Anyway, does anyone know of any good discussions on getting started on a good testing workflow, one that talks about moving between your acceptance/integration tests to you unit test and what not.

example for .net would be great, but since most testing frameworks cucumber(gherkin)/rspec etc. are all meant to be fairly readable any example should be good.

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

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

发布评论

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

评论(2

弄潮 2024-11-26 19:07:12

“实际上,很难看出实际差异是什么”

我只能提供一般性的测试建议。大型软件项目通常涉及某种层次结构。

  • 在开发阶段,开发人员通常会对小型单元进行白盒测试(单元测试)。这里可以使用内部知识来减少测试用例的数量(如果两个函数是正交的,则不需要测试所有可能的组合)。这是测试层次结构中的低端。
  • 在集成中,软件组件被放在一起,不同的人(测试人员)仅测试接口处的行为(黑盒测试)。这些人不了解内部结构,只了解接口的规格。
  • 系统集成结合了更大的系统。
  • 等等。

为了使测试有效,每个级别都依赖于在较低级别中测试的完全预先测试的组件。否则,更高的测试级别必须包括其组件的基本功能,但只能使用黑盒测试(必须假设最坏的情况,即要测试的功能之间的依赖关系)。因此测试用例的数量呈指数级增长,使得全覆盖的测试变得不可能。

分层方法优化了这里的测试工作。

"in practice it could be hard to see what the difference actually is":

I can only give general testing advice. Big software projects normally involve some kind of hierarchy.

  • In the developing phase developers do normally white box tests for small units (unit tests). Knowledge of internals can be used here to reduce the number of test cases (if two functions are orthogonal, you don't need to test all possible combinations). This is the lower end in the testing hierarchy.
  • In integration software components are put together and different persons (testers) test only the behaviour at the interfaces (black box testing). These persons don't have knowledge of internals, just the specs of the interfaces.
  • System integration combines even bigger systems.
  • and so on.

In order for testing to be effective, each level relies on fully pretested components tested in a lower level. Otherwise a higher testing level would have to include basic functionality of its components, but can only use black box testing (which has to assume the worst case, that is dependencies between features to test). So the number of test cases is increasing exponentially, making testing with full coverage impossible.

The hierarchical approach optimizes test efforts here.

夏了南城 2024-11-26 19:07:12

请参阅有关不同类型测试的视频。不同类型的测试技术通过表格进行比较。

Refer to the video on different types of testing. Different types of test techniques are compared with a table.

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