如何维护 selenium 的对象存储库而不是一次又一次地编写它?
How to maintain object repository for selenium instead of writing it again and again?
我正在做一个自动化,我一次又一次地为一些元素编写 xpath 如何维护一个集中的存储库以从 java 代码访问。
有多种方法可以为 locators.For 创建通用对象存储库,例如:
- 从 excel sheet 读取并在执行开始时将所有定位器放入 hashmap。
- 创建一个 class 并将定位器保留为 class 级变量。
- 像键值对一样从属性文件中读取。
这完全取决于你的框架。
使用页面对象模型。
参考这个:CLICK
引用上面 link 的内容,这是它的好处之一:
The Second benefit is the object repository is independent of test cases, so we can use the same object repository for a different purpose with different tools. For example, we can integrate POM with TestNG/JUnit for functional Testing and at the same time with JBehave/Cucumber for acceptance testing.
我正在做一个自动化,我一次又一次地为一些元素编写 xpath 如何维护一个集中的存储库以从 java 代码访问。
有多种方法可以为 locators.For 创建通用对象存储库,例如:
- 从 excel sheet 读取并在执行开始时将所有定位器放入 hashmap。
- 创建一个 class 并将定位器保留为 class 级变量。
- 像键值对一样从属性文件中读取。
这完全取决于你的框架。
使用页面对象模型。
参考这个:CLICK
引用上面 link 的内容,这是它的好处之一:
The Second benefit is the object repository is independent of test cases, so we can use the same object repository for a different purpose with different tools. For example, we can integrate POM with TestNG/JUnit for functional Testing and at the same time with JBehave/Cucumber for acceptance testing.