Skip to main content

Posts

Showing posts from 2018

Team Building

Team Building Abstract "Talent wins games, but teamwork and intelligence win championships." A famous quote embarks on the importance of teamwork over individual contribution. Teamwork is so critical that it is virtually impossible to achieve anything big without it. The power of a team lies within the individual strengths of its individual team member. This paper aims at emphasizing the importance of teamwork, challenges that can arise working in a team, various stages in forming a team and some useful activities to build a good team.   What is a Team and Team Building? A Team is a group of people linked together in a work or activity as a group on one side. TEAM meaning : T : Together E : Enabling each other to A : Accomplish M : More Team building is a process of building and nurturing a greater sense of participation and faith among team members. Challenges to work in teams/Purpose of Team Building: o    Conf

Play with DropDowns (Selenium)

Play with DropDowns (Selenium) 1. To check whether a particular option available in drop down or not: public class OptionPresentOrNotDropdown { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "pathofyourchrome.exe"); WebDriver driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.get("https://yoursite.com"); WebElement dropdownElement = driver.findElement(By.xpath("//select[@id='Store']")); Select dropdown = new Select(dropdownElement); List allElements = dropdown.getOptions(); System.out.println("Values present in Single Value Dropdown"); for (WebElement element : allElements) { // This will iterate over each element and print the text String dropdownValue = element.getText(); if (dropdownValue.equals("Selenium")) { System.out.println("Selenium is present.)"); }

Oracle DB Testing with Selenium

1. For Database Verification in To use Selenium Webdriver, we need to use the JDBC ("Java Database Connectivity"). Its API provides following classes and interfaces: Driver Manager Connection Statement ResultSet SQLException 2. In order to test our Database using Selenium, we need to perform the following steps: a. Make a connection to the Database. Syntax is: Connection DB_Con= DriverManager.getConnection(URL, "USERID", "PASSWORD" ) And load JDBC Driver class using the syntax: Class.forName("oracle.jdbc.driver.OracleDriver"); b. Execute Queries to the Database Statement stmt = DB_Con.createStatement(); stmt.executeQuery(select *  from employee;); ResultSet rs= stmt.executeQuery(query); c. Process the result set based on your need: while (rs.next()){ String FisrtName= rs.getString(1);          String LastName= rs.getString(2); System.out.println("First Name is: " +FisrtName); System.out.p

Re-run failed test cases in Cucumber with TestNG

How to re-run your failed test cases in Cucumber with TestNG? 1. Add rerun:target/rerun.txt in your Cucumber plugin Option like: plugin = {"rerun:target/rerun.txt" } 2. Once you execute you main Runner class it will create "rerun.txt" file in "target" folder which will have your failed test cases like: OrderFlow 4:4  LoginFlow 21:21 3. You need to take this "rerun.txt" and bind it with features option of Cucumber in a new Runner class say "FailedScenarios" like: features = "@target/rerun.txt" Your TestRunner (Main) class will be like: @CucumberOptions( features = "src\\main\\java\\com\\qa\\feature", glue = { "stepDefinitions" }, plugin = { "com.cucumber.listener.ExtentCucumberFormatter:", "rerun:target/rerun.txt" }, monochrome = true, strict = true, dryRun = false, tags = { "@Regress

Selenium Snippets (WebDriver)

How would we make sure that a page is loaded using Selenium WebDriver?                  import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.JavascriptExecutor; import org.testng.AssertJUnit; import org.testng.annotations.Test; public class CheckPageLoad { static WebDriver driver; static String pageLoadingStatus = null; @Test     void TestCase1_HomePage_LoadingCheck(){ System.setProperty("webdriver.chrome.driver","Add your chromedriver.exe path here"); driver=new ChromeDriver();   driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.get("https://postbysanta.in"); JavascriptExecutor js; js = (JavascriptExecutor) driver; String pageLoadStatus = (String)js.executeScript("return