Automation standards for testing a REST webservice

  • 31
    Aug

    Automation standards for testing a REST webservice

    The testing strategy is not just a one time document, which defines standards of testing. It’s reflects on all the activities — development, testing and the continuous loop of...

    Read More
  • 30
    Aug

    Unique words and their count in a text file

    import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; import...

    Read More
  • 30
    Aug

    Capture logs for timestamp for each action performed with WebDriver (selenium)

    Step 1: Create a class implementing “WebDriverEventListener” e.g. import java.sql.Date; import java.sql.Timestamp; import java.time.LocalDate; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.events.WebDriverEventListener; public class EventHandler implements WebDriverEventListener { //private...

    Read More
  • 30
    Aug

    Implementing WebDriverEventListener to highligh the field under test with Selenium webdriver

    Following code can be used to highlight an element using javascript import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.Test; public class HighlighterClass { @Test public...

    Read More
  • 29
    Aug

    Click a link

    private void clickLink(String element, int wait) throws Exception { WebElement myLink = (new WebDriverWait(driver, wait)).until(ExpectedConditions.presenceOfElementLocated(By.linkText(element))); driver.findElement(By.linkText(element)).click(); }

    Read More
  • 29
    Aug

    handling WebDriver exceptions before test execution with TestNG

    One can use static initialization block to catch exception like this: public class A { static final WebDriver wd; static { try { wd = new FirefoxDriver(); } catch...

    Read More
  • 29
    Aug

    Softasserts in TestNG

    There are two types of Assert: 1. Hard Assert => script execution stops (on failure of such asserts) 2. Soft Assert => script execution continues (on failure of such...

    Read More
  • 28
    Aug

    Set functions in Java

    package Set; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.Spliterator; public class SetsExamples { static Set initSet1() { Set set1 = new HashSet(Arrays.asList(11,12,13,14,15)); return set1; } static...

    Read More
  • 24
    Aug

    Get free disk space from Java program

    Following code snippet can be used to find the free disk space on local file system import java.io.File; public class FreediskspaceinGB { public static void main(String args) { File...

    Read More
  • 24
    Aug

    kill a running process from your java program (in Windows)

    Following code snippet can be used to kill a process on windows system package practice; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class WindowsProcessKiller { // command used to...

    Read More