最佳实践:使用Selenium和Java进行UI测试自动化

huangapple go评论80阅读模式
英文:

Best Practices for UI Test Automation with selenium and Java

问题

以下是翻译好的内容:

我们公司正试图采用UI测试自动化。他们向我展示了他们之前在测试自动化方面的尝试,基本上符合你对被过度劳累的QA工程师的期望,他们被要求在短时间内除了其他职责外还要创建测试自动化项目。从我看到的情况来看,它有许多缺陷,并且并不成功。我在这个领域是个初学者,我想了解以下内容:

  1. UI测试自动化最佳实践的详细指南。
  2. 有没有一些受人尊敬的软件开发公司完成的测试自动化项目的GitHub存储库,展示最佳实践。

我在这里发帖的原因是,我在网上找到的大多数指南都很基础或缺乏细节。此外,几乎不可能找到一些软件公司完成的测试自动化项目。如果你们中有人在一个有公共存储库的公司工作,请在这里分享,这将非常有帮助。

英文:

Our company is trying to adopt UI test automation. They showed me their previous attempt on Test Automation which was basically what you can expect from over worked QA engineers who are asked to create a test automation project alongside their other duties in short frame of time. From what i saw it had many flaws and wasn't successful. I am beginner in this field and i would like to find out about,

  1. Any detailed guide of best practices in UI Test Automation
  2. Any github repo for test automation project done by some
    respectable company in software development showcasing best practices.

The reason i am posting here is that most of the guides i found online was basic or lacking details. Also it's impossible to find test automation project done by some software company. If any of you guys work in a company which has public repo kindly share it here that would be mighty helpful.

答案1

得分: 0

你可能在网上找不到相关内容,因为通常这些框架资料代表着时间和投资。它们要么是可销售的资料(例如,拥有通用框架的咨询公司),要么是为客户定制的(例如,揭示内部系统运作方式)。

自动化框架始于一些需求收集。有很多事情要考虑 - 以下是一些示例想法:

  • 你知道你想要测试什么吗?
  • 它纯粹是网页吗?是厚客户端吗?涉及移动设备吗?还是混合匹配?
  • 你是否与开发团队合作?在进入用户界面之前,你知道在不同层次上进行了什么测试吗?
  • 你是否具备跟进完成这个过程的正确技能?

如果你在谷歌上搜索“自动化框架需求”,你会得到很多想法。

这篇文章(免责声明! - 是我写的)讨论了在不涉及代码的情况下从顶层遇到的自动化问题。我认为其中大部分都是很好的实践,有些部分你可以在早期进行计划。

从文章中摘录一些内容:

> 自动化需要测试正确的事物
>
> 自动化需要简单运行
>
> 自动化需要良好运行

它使用了我职业生涯中见过的一些做得不好的事例,并介绍了如何进行纠正。

除此之外……

现代自动化通常会引导你关注测试自动化金字塔(这次不是我的文章)。

当你到达较低层次时,通用的编程规则很重要。我不能直接为你设计的框架提供明确的指引,但简单的规则会有所帮助:

最后一个想法是,你不必构建一个框架。有一些通用的开源框架可以帮助你入门。

英文:

You probably aren't finding stuff online because typically those framework materials represent time and investment. They're either sell-able material (e.g. consultancies that have generic frameworks) or bespoke for a client (which e.g. expose internal system workings).

An automation framework starts with some requirements gathering. Loads of things to consider - Some sample thoughts:

  • Do you know what you want to test?
  • Is it purely web? Is it thick client? does it involve mobile? a mix and match?
  • Are you involved with the dev team? do you know what's been tested at the different levels before you get to the UI?
  • Do you have the right skills to follow this through?

If you google "automation framework requirements" you'll get a lot of ideas.

This article [disclaimer! - i wrote it] talks about automation problems you encounter from the top level without into the code. I'd consider most of those pretty good practice and there are parts of it you can plan for early on.

Taking a bit from the article:

> Automation needs to test the right things
>
> Automation needs to just run
>
> Automation needs to run well

It uses examples from my career of things I've seen done wrong and how to correct them.

Beyond that....

Modern automation typically steers you towards the test automation pyramid (not my article this time).

When you get to the lower level, general programming rules are important. I can't give you a direct steer on a framework you've not designed but simple rules help:

Final thought here is you don't have to build a framework.There are generic open source frameworks out there which can get you started.

答案2

得分: 0

  1. 确保应用程序处于回归阶段
  2. 自动化和稳定测试需要很多时间
  3. 不要试图在开始时自动化所有内容。自动化最重要的测试。网站上大多数人遵循的流程。
  4. 决定框架 - 数据驱动、混合或POM
  5. 未来节省大量时间的框架选择决策。数据驱动最简单且易于更改。POM和混合较为复杂,但可重用性更强。
  6. 在选择新框架之前,查看并了解一些现有的自动化框架。
  7. 决定所需的报告类型。
英文:
  1. Make sure that application is in Regression stage
  2. Automating and stabilizing tests take a lot of time
  3. Don't try to automate everything in the beginning. Automate the most important tests. Flows which are followed by most of the people on the Website.
  4. Decide the framework - data-driven or hybrid or POM
  5. The decision of which framework to use saves a lot of time in the future. Data-driven is most simple and easy to change as well. POM and hybrid are complex but can be more reusable.
  6. Look and understand some existing automation frameworks before you choose a new one.
  7. Decide on the type of reporting you to need

答案3

得分: 0

使用Selenium进行自动化测试是一个学习曲线。它不像从一个工作示例中复制那样简单。这是一篇关于Selenium自动化测试的文章,可以帮助您开始学习最佳实践。在开始使用Selenium的旅程时,选择一个小的UI功能进行自动化,以便您熟悉所需组件的设置,以及如何运行和管理测试。尝试从测试诸如登录过程之类的内容开始,之后您可以创建更多的测试,一旦您完全理解整个Selenium/Java环境,就可以融入更多的UI功能。

英文:

Using Selenium for automated testing is a learning curve. It’s not as simple as copying from a working example. This is an article on Selenium automation testing to help you get started with learning the best practices. When beginning your journey with Selenium, identify a small UI feature to automate so you can familiarise yourself with the setup of required components, and how to run and manage the test. Try start with testing something like a login process, after which you can create more tests that incorporate more UI functionality once you fully understand the whole Selenium/Java environment.

huangapple
  • 本文由 发表于 2020年8月21日 18:55:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/63521531.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定