红宝石测试用例
我的任务是在 Ruby 上编写一些测试用例。 任务如示例所示:
- 访问某个网站。
- (断言显示了某个页面)
- 在文本框中输入文本
- 按提交按钮
- (断言用户被重定向到正确的页面)
- (断言向用户提供了正确的信息)
所以,问题是:如何组织这样的内容具有更多断言的测试用例。 例如,我是否应该检查第 2 步是否发生,然后才转到下一步,因为如果第 2 步失败,则没有必要继续前进。 我不知道如何组织这样的测试用例。
I have a task of writing some test cases on Ruby.
The task is as in example:
- Visit the some website.
- (Assert that certain page was displayed)
- Enter a text into a textbox
- Press the submit button
- (Assert that user was redirected to a right page)
- (Assert that user was presented with the right information)
So, the question is: how to organize such test cases with a bigger number of asserts. Should I check for example whether step 2 occurred and only then pass to the next steps, because if step 2 fails, there is no sense to move further. I do no not know how to organize such test cases.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的做法听起来很合理。 如果一个步骤依赖于前一个步骤,那么如果前一个步骤失败,则对其进行测试似乎没有什么意义。 如果依赖的步骤失败,则可以假设所有后续的依赖步骤也将失败。 总的来说,您应该强迫自己像计算机一样思考,并描绘出正在测试的过程的每个步骤。 按顺序隔离每个步骤并确保它们正常工作。
Your approach sounds reasonable. If a step depends on a preceding step, then there seems little point in testing for it if the preceding step has failed. If the depended-upon step fails, then it can be assumed that all subsequent dependent steps will fail as well. Overall, you should force yourself to think like a computer and delineate each step of the process being tested. Isolate each step in order and make sure they're working properly.