Test Automation Framework - Interview Questions
Difference between TDD, BDD, Keyword driven frameworks?
TDD – Test Driven Development Test driven development is a coding concept when the tests are written before the code is written. This is usually a coding method used by developers directly where the developers write the unit tests before writing the code. The QA professional sometimes help in writing those unit tests by working with the developers to create the different test cases for those unit tests. This is especially true in the case of calculations, boundary testing.
BDD – Behavior Driven DevelopmentBehavior driven development is done by converting test cases into readable automation code using the Gherkin language and then in a different file, writing the classes and functions for the corresponding actions in the test cases.
KDD – Keyword Driven DevelopmentKeyword driven development is a style of development where the keywords are entered in a database or in an excel spreadsheet and referenced in the automation.
DDD – Data Driven DevelopmentData driven development is a style of development where the data is entered in a database or in an excel spreadsheet and referenced in the automation.
What are all OOPS concepts used in your framework? Explain with an example.
Abstraction
Abstraction is the concept of hiding internal details and describing things in simple terms. For example, a method that adds two integers. The method of internal processing is hidden from the outer world. There are many ways to achieve abstraction in object-oriented programming, such as encapsulation and inheritance.
The most widely used concept. In our framework, we had a function library that had most methods written there which we were using while writing step definitions. This is one great example of Abstraction where we do not need to care about what code is written to scroll to one element and directly use the method.
Encapsulation
Encapsulation is the technique used to implement abstraction in object-oriented programming. Encapsulation is used for access restriction to class members and methods. Access modifier keywords are used for encapsulation in object-oriented programming. For example, encapsulation in java is achieved using private, protected, and public keywords.
This decides which object or Class or a method or variable would have which access modifier. This depends on the scope of that method or variable. For example, the getWebdriver method returns the driver element of a specified browser, this method was public which was accessible from all the class elements in any package, similarly, verify methods were with access modifier protected
private - Only the current class will have access to the field or method. protected - Only the current class and subclasses (and sometimes also same-package classes) of this class will have access to the field or method. public - Any class can refer to the field or call the method.
Polymorphism
Polymorphism is the concept that an object behaves differently in different situations. There are two types of polymorphism – compile-time polymorphism and runtime polymorphism. Compile time polymorphism is achieved by method overloading. For example, we can have a class as below. Multiple draw methods but they have different behavior. This is a case of method overloading because all the methods name is the same and the arguments are different. Here compiler will be able to identify the method to invoke at compile time, hence it’s called compile-time polymorphism.
Runtime polymorphism is implemented when we have “IS-A” relationship between objects. This is also called as method overriding because the subclass has to override the superclass method for runtime polymorphism. If we are working in terms of the superclass, the actual implementation class is decided at runtime. The compiler is not able to decide which class method will be invoked. This decision is done at runtime, hence the name as runtime polymorphism or dynamic method dispatch. Java compilers don’t know the actual implementation class of Shape that will be used at runtime, hence runtime polymorphism.
Inheritance
Inheritance is the object-oriented programming concept where an object is based on another object. Inheritance is the mechanism of code reuse. The object that is getting inherited is called a superclass and the object that inherits the superclass is called a subclass.
How are you maintaining the object repository?
We are using objects.properties file to maintain all the locators. So, simply to identify any object, we need to access the file and use the locator value.
What is a page object model? Why you are not using it?
Initially when we started to develop the framework, objects were a few hundred and most objects were identifiable with ids or names, this seemed more correct way in this regard. However, maintaining all the object locators in one property file is difficult and gets complicated when it comes to thousands of locators.
Where are you storing URL, Login related data?
There was one more file to LaunchLogin of the application as the login required various properties to get loaded, so that was handled in different functions. Which consists of Login Url, AuthenticationSerialKey, and other properties required to select while login a page, like the type of user, prepaid login or postpaid login, etc.