Selenium,Nunit 最佳实践? [英] Selenium, Nunit Best Practices?

查看:52
本文介绍了Selenium,Nunit 最佳实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想了解更多关于如何使用 Selenium IDE 和 RC 来创建好的自动化测试.有没有人有兴趣分享信息.或讨论这个?尤其是对于以下内容:

I would like to learn more about how to use Selenium IDE and RC for creating good automation tests. Is there anybody who is interested in sharing info. or discussing this? Especially for things like:

1) 组织 UI 测试的好方法是什么?现在我正在通过 NUnit 执行这些测试,并按照字母名称的顺序执行测试.有没有更好的办法.(我正在用 C# 而不是 Java 编写 selenium 脚本)

1) What's a good way to organize the UI tests? Right now I am executing these tests thru NUnit and that executes the tests in the order of their alphabetical names. Is there a better way. (I am writing the selenium scripts in C# and not java)

2) 如何记录结果?

3) 模块化 Selenium RC 测试?我这里有问题.由于我通过 NUnit 执行我的测试,我能想到的唯一方法是为测试提供 ID,以便它们以正确的顺序运行.此外,我必须在 textfixture 类中一个接一个地编写所有测试.有没有更好的方法?我尝试创建其他文件,但是当我在那里创建测试并选择它们在 NUnit 中运行时,看起来 selenium 服务器甚至没有启动.

3) Modularizing the Selenium RC tests? I am having a problem here. Since I am executing my tests thru NUnit, the only way I could figure was to give IDs to the tests so that they get run in the right order. Also I am having to write all my tests one after the other in the textfixture class. Again is there a better way? I tried creating additional files but when I create tests there and select them to run in NUnit, it looks like the selenium server doesn't even get started.

4) 自动化测试的最佳实践是什么?任何指向任何网站/书籍/等的指针?

4) What are the best practices for automation testing? Any pointers to any sites/books/ etc.?

这些看似简单的事情,但我花了数周时间试图想出更好的方法,所以如果有人愿意提供建议或意见,我会非常感激!

These might seem very simple things but I've spent weeks trying to come up with better ways, so if somebody is willing to offer suggestions or input I'll really appreciate it!

谢谢!

推荐答案

我已经为您回答了以下每个问题.

I have answered each of the questions for you below.

  1. 测试与它们运行的​​顺序无关.如果您开始担心,您将开始引入测试的脆弱性.如果您必须在每次测试时登录,请这样做,如果您需要在测试期间注册多个用户,请这样做.测试应始终能够自行运行.

  1. Tests shouldn't matter about the order that they run in. If you start worrying about that you are going to start introducing flakiness of tests. If you have to login with each test do so, if you need to register a number of users during your tests do so. Tests should always be able to run on their own.

Nunit 将其结果记录在一个 XML 文件中.这将有一个通过和失败的列表,并且通常由几乎所有连续

Nunit logs its results in a XML file. This will have a list of the passes and fails and is normally rendered in a pretty fashion by nearly all Continuous

查看我对 Selenium RC 模块化最佳实践的回答测试脚本

  • 测试应该始终有一个已知的起点.在 Selenium 的上下文中,这可能意味着打开某个页面以启动工作流.
  • 测试不应依赖于任何其他测试来运行.如果测试要添加某些内容,则无需单独测试来删除它.这是为了确保如果在一次测试中出现问题,并不意味着您有很多不必要的故障需要检查.
  • 测试一次只能测试一件事.
  • 测试应自行清理.

这篇关于Selenium,Nunit 最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆