发现测试用例的方法有哪些

发布于 2024-08-27 12:21:23 字数 329 浏览 7 评论 0原文

总之,

我是一名开发人员,但想了解更多关于测试流程和方法。我相信这有助于我编写更可靠的代码,因为它改进了我可以在将产品交付给测试团队之前使用单元测试进行测试的案例。我最近开始研究软件项目的测试驱动开发和探索性测试方法。

现在我可以更轻松地找到我编写的代码的测试用例。但我很想知道当我不是被测功能的开发人员时如何发现测试用例。 例如,我们有一个在各种网站上看到的基本用户注册表。假设测试它的人不是表单的开发人员,应该如何测试表单上的输入字段,您的策略是什么?您将如何发现测试用例?我相信这种测试受益于探索性测试方法,但我在这里可能是错的。

我将不胜感激您对此的看法。

谢谢, 字节

All,

I am a developer but like to know more about testing process and methods. I believe this helps me write more solid code as it improves the cases I can test using my unit tests before delivering product to the test team. I have recently started looking at Test Driven Development and Exploratory testing approach to software projects.

Now it's easier for me to find test cases for the code that I have written. But I am curios to know how to discover test cases when I am not the developer for the functionality under test.
Say for e.g. let's have a basic user registration form that we see on various websites. Assuming the person testing it is not the developer of the form, how should one go about testing the input fields on the form, what would be your strategy? How would you discover test cases? I believe this kind of testing benefits from exploratory testing approach, i may be wrong here though.

I would appreciate your views on this.

Thanks,
Byte

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

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

发布评论

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

评论(10

紫轩蝶泪 2024-09-03 12:21:23

虫子!在添加新测试用例的项目中,我最喜欢的起始位置之一是查看错误跟踪系统。现有的错误本身就是测试用例,但它们也可以引导您使用新的测试用例。如果某个特定模块有错误,它可能会导致您在该领域开发更多测试用例。如果某个特定的开发人员似乎引入了某类错误,它可以指导该开发人员对未来项目的测试。

另一个有用的考虑因素是更多地关注测试技术而不是测试用例。在您的注册表单示例中,您将如何从业务需求的角度对其进行攻击?安全?并发?输入有效/无效?

Bugs! One of my favorite starting places on a project for adding new test cases is to take a look at the bug tracking system. The existing bugs are test cases in their own right, but they also can steer you towards new test cases. If a particular module is buggy, it can lead you to develop more test cases in that area. If a particular developer seems to introduce a certain class of bugs, it can guide testing of future projects by that developer.

Another useful consideration is to look more at testing techniques, than test cases. In your example of a registration form, how would you attack it from a business requirements perspective? Security? Concurrency? Valid/invalid input?

软糯酥胸 2024-09-03 12:21:23

测试计算机软件是一本关于如何进行各种不同类型的好书测试;黑盒、白盒、测试用例设计、规划、管理测试项目,可能还有很多我错过的东西。

对于您给出的示例,我会执行以下操作:

  1. 对于每个字段,我会考虑您可以输入的可能值,包括有效值和无效值。我会寻找边界情况;如果字段是数字,如果我输入比下限小一的值,会发生什么情况?如果我输入下限作为值会发生什么?等等
  2. 然后我会使用像微软的工具 成对独立组合测试 (PICT) 工具,在所有输入的情况下生成尽可能少的测试场景字段。
  3. 我还会编写一个自动化测试,使用随机输入敲击表单,捕获结果并查看响应是否有意义(键盘上的虚拟猴子)。

Testing Computer Software is a good book on how to do all kinds of different types of testing; black box, white box, test case design, planning, managing a testing project, and probably a lot more I missed.

For the example you give, I would do something like this:

  1. For each field, I would think about the possible values you can enter, both valid and invalid. I would look for boundary cases; if a field is numeric, what happens if I enter a value one less than the lower bound? What happens if I enter the lower bound as a value? Etc.
  2. I would then use a tool like Microsoft's Pairwise Independent Combinatorial Testing (PICT) Tool to generate as few test scenarios as I could across the cases for all input fields.
  3. I would also write an automated test to pound away on the form using random input, capture the results and see if the responses made sense (virtual monkeys at a keyboard).
过气美图社 2024-09-03 12:21:23

提出问题。保留一个疑问词列表,并强迫自己提出有关产品或功能的问题。像这样的列表可以帮助您摆脱众所周知的框框或陈规。如果你什么也没想到,就不要在疑问词上花太多时间。

  • 谁是
  • 谁的
  • 什么
  • 地点
  • 何时
  • 为什么
  • 多少
  • 然后

,当你回答他们时,问“其他”问题。这迫使你至少暂时不相信你的初步结论。

  • 还有谁还
  • 有谁的
  • 等等……

然后,问“不是”的问题——否定或反驳你的假设,并挑战它们。

  • 谁不(例如,谁可能不需要访问此安全功能,为什么?)
  • 什么不(用户不关心哪些数据?用户不会在此文本框中放入什么?您确定吗?)
  • 等等。 W

对问题的其他修饰语可以是:

  • else
  • W not
  • W 风险
  • W different
  • 组合两个问题词,例如 Who 和 When。

Ask questions. Keep a list of question words and force yourself to come up with questions about the product or a feature. Lists like this can help you get out of the proverbial box or rut. Don't spend too much time on a question word if nothing comes to you.

  • Who
  • Whose
  • What
  • Where
  • When
  • Why
  • How
  • How much

Then, when you answer them, ask "else" questions. This forces you to distrust, for a moment at least, your initial conclusions.

  • Who else
  • Whose else
  • etc..

Then, ask the "not" questions--negate or refute your assumptions, and challenge them.

  • Who not (eg, Who might not need access to this secure feature, and why?)
  • What not (what data will the user not care about? What will the user not put in this text box? Are you sure?)
  • etc...

Other modifiers to the qustions could be:

  • W else
  • W not
  • W risks
  • W different
  • Combine two question words, eg, Who and when.
反目相谮 2024-09-03 12:21:23

就表单而言,我会查看可以输入的内容并测试其中的各种边界条件,例如,如果未提供用户名会发生什么?我想起有几种不同形式的测试:

  1. 黑盒测试 - 这是您无需查看正在测试的内容即可进行测试的地方。这里的挑战是无法看到内部可能会导致限制什么是有用的测试以及有多少不同的测试值得的问题。这当然是一些默认测试的样子。

  2. 白盒测试 - 在这里您可以查看代码并获得代码覆盖率等指标,以确保您覆盖了一定比例的代码库。这通常会更好,因为在这种情况下,您可以更多地了解正在做什么。

与逻辑测试相比,还有一些性能测试也值得注意,例如表单验证我的速度有多快,而不仅仅是表单执行此操作。

In the case of the form, I'd look at what I can enter into it and test various boundary conditions there,e.g. what happens if no username is supplied? I'm reminded of there being a few different forms of testing:

  1. Black box testing - This is where you test without looking inside what is being tested. The challenge here is not being able to see inside can cause issues with limiting what are useful tests and how many different tests are worthwhile. This is of course what some default testing can look like though.

  2. White box testing - This is where you can look at the code and have metrics like code coverage to ensure that you are covering a percentage of the code base. This is generally better as in this case you know more about what is being done.

There are also performance tests compared to logic tests that are also worth noting somewhere,e.g. how fast does the form validate me rather than just does the form do this.

残花月 2024-09-03 12:21:23

从不同的角度确定你的假设:

  • 用户怎么可能会误解这一点?
  • 为什么我认为它会这样做或应该这样做?
  • 我对该软件的工作方式可能存在哪些偏见?
  • 我如何知道需求/设计/实现是需要的?
  • 对于该软件的优先级、重要性、目标等,可能存在哪些其他观点(用户、管理员、经理、开发人员、法律)?
  • 是否正在构建正确的软件?
  • 我真的知道有效的姓名/电话号码/身份证号码/地址/等是什么样子吗?
  • 我缺少什么?
  • 我可能会对(此处插入名词)产生误解

另外,请使用此处注明的任何助记符和测试列表:

Identify your assumptions from different perspectives:

  • How can users possibly misunderstand this?
  • Why do I think it acts or should act this way?
  • What biases might I have about how this software should work?
  • How do I know the requirements/design/implementation is what's needed?
  • What other perspectives (users, administrators, managers, developers, legal) might exist on priority, importance, goals, etc, of this software?
  • Is the right software being built?
  • Do I really know what a valid name/phone number/ID number/address/etc looks like?
  • What am I missing?
  • How might I be mistaken about (insert noun here)?

Also, use any of the mnemonics and testing lists noted here:

我ぃ本無心為│何有愛 2024-09-03 12:21:23

与他人讨论测试想法。当你向别人解释你的想法时,你往往会找到改进或扩展它们的方法。

Discussing test ideas with others. When you explain your ideas to someone else, you tend to see ways to refine or expand on them.

公布 2024-09-03 12:21:23

小组头脑风暴会议。 (或必要时非正式地成对)

Group brainstorming sessions. (or informally in pairs when necessary)

淡笑忘祈一世凡恋 2024-09-03 12:21:23

制作数据表,在顶部和侧面列出主要特征,并考虑每对之间可能的相互作用。在三个维度上执行此操作可能会变得笨拙。

Make data tables with major features listed across the top and side, and consider possible interactions between each pair. Doing this in three dimensions can get unwieldy.

猫卆 2024-09-03 12:21:23

保留包含不同类型任务的常见问题和问题类型的测试目录,例如整数验证和工作流程步骤等。

Keep test catalogs with common questions and problem types for different kinds of tasks such as integer validation and workflow steps etc.

戈亓 2024-09-03 12:21:23

利用探索性测试动态满意度启发式测试策略模型,作者:James Bach。两者都提供了开始更广泛或不同地思考产品的通用方法,这可以帮助您在测试中在盒子和启发式之间切换。

Make use of Exploratory Testing Dynamics and Satisfice Heuristic Test Strategy Model by James Bach. Both offer general ways to start thinking more broadly or differently about the product, which can help you switch between boxes and heuristics in testing.

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