Skip to content

Instantly share code, notes, and snippets.

View rahulrathore44's full-sized avatar
๐Ÿ‘€
looking for freelance work

Rahul Singh Rathore rahulrathore44

๐Ÿ‘€
looking for freelance work
View GitHub Profile
@rahulrathore44
rahulrathore44 / UnitTest1.cs
Created December 31, 2020 00:41
Ope Existing Firefox browser in Selenium
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using System;
namespace SeleniumTest
{
[TestClass]
public class UnitTest1
{
@rahulrathore44
rahulrathore44 / BugCreationRunner.java
Created January 16, 2021 04:27
Cucumber runner with multiple feature file
@CucumberOptions(
features = {"src/main/java/com/webdriver/page/BugCreation.feature",
"src/main/java/com/webdriver/page/ShoppingCart.feature",
"src/main/java/com/webdriver/page/Payment.feature"
},
glue = {"com.webdriver.page","com.webdriver.generichook"},
dryRun = false,
monochrome = true,
plugin = {"pretty","json:target/bugcreationrunner.json"}
)
@rahulrathore44
rahulrathore44 / AuthorName.java
Last active January 17, 2021 02:53
Custom Block JUnit4 Class Runner that adds the author name to test method name
package com.api.automation.metadata;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface AuthorName {
@rahulrathore44
rahulrathore44 / CsvDataReader.cs
Created March 28, 2021 21:31
[CsvHelper] Reading the Data From CSV File
using CsvHelper;
using CsvHelper.Configuration;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace CsvDataReading
{
public class CsvDataReader<T>
@rahulrathore44
rahulrathore44 / BrowserInjection.feature
Last active June 26, 2021 18:54
Dependency Injection for Selenium Webdriver
Feature: To setup the browser only once
Scenario: Open the browser
Given BrowserOne_I open the URL
And BrowserOne_I wait for 5 sec
@rahulrathore44
rahulrathore44 / BaseTest.java
Last active July 25, 2021 18:33
Webdriver Containers - Testcontainers can be used to automatically instantiate and manage containers that include web browsers
package com.api.automation;
import org.openqa.selenium.chrome.ChromeOptions;
import org.testcontainers.Testcontainers;
import org.testcontainers.containers.BrowserWebDriverContainer;
import org.testcontainers.utility.DockerImageName;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
public class BaseTest {
@rahulrathore44
rahulrathore44 / ReadCSVFile.java
Created October 2, 2021 16:55
Reading the Data from CSV file using apache.commons.csv
package com.automation.csvconfig;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.commons.csv.CSVFormat;
@rahulrathore44
rahulrathore44 / AddressMatcher.java
Last active October 23, 2021 17:04
Matcher created using Hamcrest framework
package com.automation.model;
public class Address {
private int zipCode;
public int getZipCode() {
return zipCode;
}
@rahulrathore44
rahulrathore44 / BaseContainerConfiguration.java
Created April 23, 2022 21:40
Selenium Webdriver integration with Testcontainers
package com.api.automation;
import org.openqa.selenium.Capabilities;
import org.testcontainers.Testcontainers;
import org.testcontainers.containers.BrowserWebDriverContainer;
import org.testcontainers.utility.DockerImageName;
public abstract class BaseContainerConfiguration {
protected BrowserWebDriverContainer<?> container = null;
@rahulrathore44
rahulrathore44 / CsvConfiguration.java
Last active August 12, 2024 18:10
Cucumber Data Tables - Excel Data to Data Table
package io.testing.tables.csvtable;
import java.util.Objects;
public class CsvConfiguration {
private final String fileName;
public String getFileName() {
return fileName;