使用PageFactory(Selenium-WebDriver)编写TestCases.好处? [英] Write TestCases using PageFactory (Selenium-WebDriver). Advantages?

查看:79
本文介绍了使用PageFactory(Selenium-WebDriver)编写TestCases.好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Selenium2中编写测试用例时,采用PageFactory方式是一种好习惯吗?如果是,为什么?

坦率地说,我在编写测试用例时从未使用过它们,也没有错过.但是我想知道使用PageFactory与不使用它相比有什么优点.

解决方案

从我的角度来看,优点是,所有id和xpath都仅位于代码中的一个位置,另一方面,它们之间的抽象层实现和测试本身.

这将使非程序员可以测试网站对我有什么用,因为有些人确切地知道什么是工作流程,哪些功能最重要,但根本不属于开发团队或工程师.

最后但并非最不重要的是, PageFactory 这个术语非常有用./p>

基于这些原因,我们决定使用PageObjects从500多个Selenium 1测试用例切换到Selenium 2.并尝试通过增加可维护性,可用性和可伸缩性来补偿创建PO的工作,这肯定会超过标准测试执行的工作

Is it a good practice to go the PageFactory way when writing testcases in Selenium2? If yes why?

To be frank I have never used them when writing test-cases and have not missed it either. But I would to know what are the advantages of using PageFactory over not using it.

解决方案

From my point of view the advantages are on the one hand, all the ids and xpaths at only one place in code, on the other hand the abstraction layer between the implementation an the test itself.

This will allow non- programmers to test the websites what's useful for me, because some people know exactly what the workflows are and which functionality is the most important but are not part of the development teams or engineers at all.

Last but not least, the PageFactory term is quite useful.

Based on these reasons we decided to switch from over 500 Selenium 1 testcases to Selenium 2 with PageObjects. And try to compensate the effort of creating POs, which will surely exceed the effort for std test executions, by increased maintainability, usability and scalability

这篇关于使用PageFactory(Selenium-WebDriver)编写TestCases.好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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