top of page

My Items

I'm a title. ​Click here to edit me.

Abstract Factory design pattern

Abstract Factory design pattern

The Abstract Factory design pattern is a creational design pattern that provides an interface for creating families of related or dependent objects without specifying their concrete classes. It is part of the Gang of Four (GoF) design patterns.
Here's how the Abstract Factory pattern works: Abstract Factory Interface: It defines a set of methods that create different abstract products (e.g., WebBasePage and BasePageAssertion). These methods usually return these abstract products.
Concrete Factories: Concrete factories implement the abstract factory interface. Each concrete factory is responsible for creating a family of related concrete products. For example, you might have a WebFactory that creates Browser-specific products and a MobileFactory that creates Android/iOS-specific products.
Abstract Products: These are abstract classes or interfaces that define the common interface for different product types within a family. For example, you might have abstract products like Button, Checkbox, and TestInput for a user interface library.
Concrete Products: Concrete products are the actual classes that implement the abstract product interfaces [eg: LoginPageElement]. Each concrete factory is responsible for creating its set of concrete products. For example, the WebFactory creates WebButton, WebCheckbox, and WebWindow, while the MobileFactory creates MobileButton, MobileDropDown, and MobileTextInput.
Client Code: The client code interacts with the abstract factory and the abstract product interfaces. It requests concrete objects [eg: LoginPage] from the factory without needing to know the specific classes of objects it's creating. Key Benefits of the Abstract Factory Pattern: Encapsulation : It encapsulates the creation of related objects, ensuring that the created objects are compatible and properly configured. Isolation of System-Specific Code : The pattern allows you to isolate system-specific code in concrete factories, making it easier to adapt your application to different platforms or configurations. Consistency : It promotes the creation of consistent families of objects, reducing the chances of compatibility issues. Scalability : You can easily introduce new families of products (e.g., new operating systems or themes) by creating new concrete factories, without modifying existing client code. Maintainability : Changes to the product families are localized within the respective concrete factories, making maintenance and updates more manageable.
Example: Imagine you are SDET automating both Web and Mobile scripts . You could have an abstract factory called PageElement with methods for creating Button and Checkbox. You might then have two concrete factories, WebFactory and MobileFactory, each implementing the BasePageElement interface and returning WebButton, WebTextInput, MobileButton, and MobileTextInput respectively.
This way, when a client wants to use elements, it can use the abstract factory and work with the abstract product interfaces (Button and TextInput) without needing to know the specific details of the underlying operating system.

Byju's

Byju's

Careers: Click to Apply Profile : QA Engineer Location : Bengaluru Date : 09th Oct 2021 Java: 1. Segregate 0's and 1's in a given integer array. 2. Write a method using java that can create only 5 objects. 3. What is Stack? 4. Explain Method overriding. 5. Write a program for a balanced equation. 6. Write a program in java for random number generation. Project Basis: 1. Explain your project. 2. What are the different types of testing you did in your project and explain? 3. Explain which testing you are doing in the current project? 4. Explain what is 404 and 406 pages and when do you get them, how to handle those?

Wipro Interview Questions

Wipro Interview Questions

Careers: Click to Apply Profile : QA Engineer Location : Pune Date : 11th May 2021 Java: What are the differences between Constructor and Methods? What are the components that are not allowed in Interface and Abstract class? Automation: What is WebDriver? What is testNG? Why do you use it? What is Maven? What is the name of folder created for Maven?
Ans) .m2 folder How do you test webpages and initialize using POM ? Difference between assert and verify? How do you verify actual and expected results?

Capgemini Interview Questions

Capgemini Interview Questions

Careers: Click to Apply Profile : QA Engineer Location : Pune Date : 26th Jan 2021 Java: What is an abstract class? What is the difference between abstract and interface? Purpose of constructor in Java? Can abstract class have a constructor? Is it possible to create an object for the abstract class? What is the difference between collection and collections? What is set? What is the difference between Hast Set and Tree Set? What is the difference between Hashmap and Linked Hashmap? How do you initiate a thread? Do you know threads concepts? Programs: Write a Program for a string = “123AM256CD”, print 2 output strings one for all the numbers and one for strings. Provide 2 ways. Given an integer = 123, give me the possible combinations ? like 123,132,231,312. Selenium: How do you handle windows in selenium? The login should be done manually, from the home page u need to execute the scripts, how? TestNG: One @test is there, would like to give it a chance 3 times whenever it fails? GitHub: Set of commands to upload a new file in git which is created in your local? Committed 2 sides, you want the branch to be reverted to the previous one? how? Jenkins: Command to start Jenkins server? How will schedule the job be executed every 1 hour?

Validate pdf data using Selenium Webdriver

Validate pdf data using Selenium Webdriver

Read PDF content to validate its content using PDFbox libraries in Selenium Webdriver. PreReq: Add dependency of PDFbox : PDDocument document = PDDocument.load(pdf_file_path);
PDFTextStripper PDFstripper = new PDFTextStripper();
String content = PDFstripper.getText(document);

System.out.println(content);

If("your_content").contains(content)
{
System.out.println("Pass");
}else{
System.out.println("Content not found");
}

Cucumber Extent Reporting

Cucumber Extent Reporting

To implement cucumber extent reporting you need to follow the steps as mentioned below: 1. Download Java 8+ version . 2. Extent reports version 3.0.6+ is required, you need to add following dependency in pom.xml for maven project: <dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.0.7</version>
<scope>provided</scope>
</dependency> If it is a java project ,download the jars from this url. 3. Add dependency for cucumber extent report: <dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>3.0.1</version>
</dependency> 4. Make sure maven-complier-plugin  AND maven-surefire-plugin are present in the pom.xml, otherwise add their dependencies as mentioned below: <dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<type>maven-plugin</type>
</dependency> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version> 5. Download extent-config.xml file from  here  & add it to “target” folder of your project. 6. Create a runner class & add the plugin in @CucumberOptions as com.cucumber.listener.ExtentCucumberFormatter:output/report.html followed by the report file as input parameter. A sample example is shown below: import org.junit.runner.RunWith;
import org.testng.annotations.AfterClass;
import com.cucumber.listener.Reporter;
import java.io.File;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(format = { "pretty", "json:target/json/output.json" },
features = {"C:\\Users\\Adminindia\\workspace\\shaurya\\cookies\\src\\test.feature"},
glue = {"step_definitions"}, tags = {"@tag1"},
plugin = {"com.cucumber.listener.ExtentCucumberFormatter:output/report.html"})

public class testrunner {
@AfterClass
public static void teardown() {

Reporter.loadXMLConfig(new File("target/extent-config.xml"));
Reporter.setSystemInfo("user", System.getProperty("user.name"));
Reporter.setSystemInfo("os", "Mac OSX");
Reporter.setTestRunnerOutput("Sample test runner output message");
}
} The above setup will generate the report in  output  directory with the name of  report.html The report will be generated as shown below:

POM Concept

POM Concept

While writing a page object method which of the following "method signature" you think is/are correct & Why? public String getScreenDataAndGoToNextScreen() public boolean login(String username, String password) public void clickOnTheCheckinButton() public List<String> tableDataAtDataScreen() public FooClass clickFooButton() Reason 1: 1 - Violates SRP, consider breaking into two functions.
2 - It's a good practice to validate positive and negative scenarios through return type as boolean. Eg. With valid username and password script should return true; and with invalid one it should return false.
3 - I would replace that with a generic button.click(), otherwise there would be many such click functions. The function should be part of a bigger workflow.
4 - Should return a double dimensional data structure since it is table data. So probably List<List<String>> or List<String[]> seem better choices for a return type.
5 - Looks fine except the same comment as #3. The "correctness" is contextual as in #3.

How to scroll page in selenium webdriver using Robot Class

How to scroll page in selenium webdriver using Robot Class

Robot rb=new Robot();
rb.keyPress(KeyEvent.VK_PAGE_DOWN);
rb.keyRelease(KeyEvent.VK_PAGE_DOWN);

How to check an AutoIt Script passed or failed in selenium webdriver

How to check an AutoIt Script passed or failed in selenium webdriver

The following code will run an AutoIt script i.e. CreateNew.exe Process p=Runtime.getRuntime().exec(“exeFiles\\CreateNew.exe”); p.waitFor(20, TimeUnit.SECONDS); Integer result = p.exitValue(); sa.assertEquals(0, result); Explanation: Run an AutoIt script i.e. CreateNew.exe Wait for 20 seconds for the AutoIt script to complete, if it doesn’t gets completed within 20 sec then the execution will move to next line. 
Note : You can change this time as per your need. This line will check whether the AutoIt script is passed or failed. Will fail the TestNG script if AutoIt is script is failed.

Appium initial setup on windows

Appium initial setup on windows

Download PDANet+ Download Node JS . Download Java JDK . Set Up Java Environment System Variable/Path: Step 1: Set up JAVA_HOME Variable Right-clicking  on ‘ My Computer’  and choosing  Properties. Choose ‘ Advanced system settings ‘. Under the  Advanced  tab Choose the ‘ Environment Variable… ‘ option.  Select  New under  System variables .  Define the  Variable name  as ‘ JAVA_HOME ‘ and  Variable value  as ‘ C:\Program Files\Java\jdk1.8.0_45 ‘  (for this example JDK version 1.8.0 was installed in ‘ C:\Program Files\Java\jdk1.8.0_45 ‘ folder; if needed, modify the real location). Step 2: Set the PATH Variable Now we need to specify the location in the  PATH variable. For  PATH , most probably it will already exists in your machine. So just select it and choose the  Edit option. In the editor add the value ‘ ;%JAVA_HOME%\bin ‘ or ‘ ;C:Program Files\Java\jdk1.8.0_191\bin ‘.  To check open  cmd. Type ‘ java -version ‘.  4. Install Android SDK a) Install Install Android SDK on Windows After downloading above install SDK & install following packages: Respective Android Version packages (ex: Android 6.0 ‘API 23’) Android SDK Build-tools Android SDK Platform-tools Google Web Driver b) Set Environment Variables: 1. Open Environment variable dialog, then under the User Variable table, click New. 2. Put  ANDROID_HOME  as variable name and provide the  path of the SDK folder  next to Variable value and click OK. 3. Go to the folder where SDK has been installed. 4. Inside the SDK folder look for ‘tools’ and ‘platform-tools’ folder. 5. Copy the path for both tools and platform-tools. 6. Open ‘Environment Variables’ dialog box. 7. Go to System Variables table and locate the Path variable. 8. Select path and click on Edit. 9. Add the ‘tools’ and platform-tools’ folder’s full path, as shown below. 5. Now Lets Setup Ecllipse: Install Ecllipse add following from Eclipse MarketPlace: Test NG Android Development Tools for Eclipse Android for Maven Eclipse 1.4.0 6. Download Appium Server 7. Download Maven After downloading configure Maven environment variables. 1. Open Environment variable dialog, then under the System variables , click New . 2. Put M2_HOME as variable name and provide the  path of the Maven folder in variable
value and click OK. 3. Now edit Path variable and add following path "%M2_HOME%\bin. ************************************************************************** That’s it finally Appium has been Set up 🙂

bottom of page