简体   繁体   English

在带有Java硒的自动化框架中使用的OOP概念的一些实时示例是什么?

[英]What are some real-time examples of OOPs concepts used in the automation framework using selenium with java?

I have been working as Manual tester for a quite sometime and also worked in few automation projects using Selenium with Java. 我从事手工测试器已有相当长的一段时间了,也曾在少数使用Java Selenium的自动化项目中工作过。 Recently, I was attending few Automation interviews as I wanted to shift to Automation using Selenium with Java. 最近,我要参加一些自动化采访,因为我想转向使用Selenium和Java进行自动化。 I faced following question in the interview "What OOPs concepts you used in the automation framework?" 我在采访中遇到了以下问题:“您在自动化框架中使用了哪些OOP概念?” I am quite sure that I have used Inheritance but remaining I am not sure. 我很确定我已经使用了继承,但是我不确定。 Is it necessary to use all the OOPs concepts in Automation framework? 是否有必要在自动化框架中使用所有OOP概念? Can anyone give me real time examples of OOPs concepts used in the automation framework? 谁能给我实时示例自动化框架中使用的OOP概念? Thanks in advance. 提前致谢。

The few concepts that you've definitely used in any automation framework are: 您肯定在任何自动化框架中使用的几个概念是:

  1. Class and Object - Classes and Objects in Java. 对象 -Java中的类和对象。 Classes and Objects are basic concepts of Object Oriented Programming which revolve around the real life entities. 类和对象是面向对象编程的基本概念,它围绕现实生活中的实体。 Class. 类。 A class is a user defined blueprint or prototype from which objects are created. 类是用户定义的蓝图或原型,从中可以创建对象。 String is an object. 字符串是一个对象。 WebDriver is object. WebDriver是对象。

  2. Abstraction - A good framework should have some level of abstraction, you have your interfaces that get implemented, abstract classes, base classes that get extended. 抽象 -一个好的框架应该具有一定的抽象水平,您要实现的接口,要扩展的抽象类,基类。

  3. Encapsulation - For example in PageObject based frameworks, you would encapsulate element locators in the PageName.java class 封装 -例如,在基于PageObject的框架中,您可以将元素定位符封装在PageName.java类中

因为我还使用了诸如封装之类的一些概念,所以将所有数据包装到单个单元中,假设所有Web元素都在一个类中,那么一个网页正在使用封装概念,并且在异常处理中的多态性概念既包含了时间,又包含了运行时的例外,因此没有这种窗口异常索引超出范围的异常关节异常我们可以在硒自动化中使用的所有这些情况

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM