Monday 4 August 2014

Top Differences between Positive and Negative Testing



    Positive Testing (Valid)
   Negative Testing (Invalid)
1. Positive Testing means testing the application or system by giving valid data.
1. Negative Testing means testing the application or system by giving invalid data.
2. In this testing tester always check for only valid set of values.
2. In this testing tester always check for only invalid set of values.
3. Positive Testing is done by keeping positive point of view for example checking the mobile number field by giving numbers only like 9999999999.
or email like xyz@abc.com
3. Negative Testing is done by keeping negative point of view for example checking the mobile number field by giving numbers and alphabets like 99999abcde.
or email like 123sdhg#$%&^&.com
4. It is always done to verify the known set of Test Conditions.
4. It is always done to break the project and product with unknown set of Test Conditions.
5. This Testing checks how the product and project behave by providing valid set of data.
5. This Testing covers those scenarios for which the product is not designed and coded by providing invalid set of data.
6. Main aim means purpose of this Testing is to prove that the project and product works as per the requirements and specifications.
6. Main aim means purpose of this Testing is try to break the application or system by providing invalid set of data.
7. This type of Testing always tries to prove that a given product and project always meets the requirements and specifications of a client and customer.
7. Negative Testing is that in which tester attempts to prove that the given product and project does, which is not said in the client and customer requirements.

GUI Automation Tools

Following are some of the open source GUI automation tools in the market:

ProductLicensed UnderURL
AutoHotkeyGPLhttp://www.autohotkey.com/
SeleniumApachehttp://docs.seleniumhq.org/
SikuliMIThttp://sikuli.org
Robot FrameworkApachewww.robotframework.org
watirBSDhttp://www.watir.com/
Dojo ToolkitBSDhttp://dojotoolkit.org/

Following are some of the Commercial GUI automation tools in the market.

ProductVendorURL
AutoITAutoIThttp://www.autoitscript.com/site/autoit/
EggPlantTestPlantwww.testplant.com
QTPHphttp://www8.hp.com/us/en/software-solutions/
Rational Functional TesterIBMhttp://www-03.ibm.com/software/products/us/en/functional
InfragisticsInfragisticswww.infragistics.com
iMacrosiOpushttp://www.iopus.com/iMacros/
CodedUIMicrosofthttp://www.microsoft.com/visualstudio/
SikuliMicro Focus Internationalhttp://www.microfocus.com/

What is GUI Software Testing?

GUI testing is a testing technique in which the application's user interface is tested whether the application performs as expected with respect to user interface behaviour.
GUI Testing includes the application behaviour towards keyboard and mouse movements and how different GUI objects such as toolbars, buttons, menubars, dialog boxes, edit fields, lists, behavior to the user input.

Wednesday 21 May 2014

Alert handling in Selenium WebDriver

try {
        Alert alert = webDriver.switchTo().alert();

        // check if alert exists
        // TODO find better way
        alert.getText();

        // alert handling
        log().info("Alert detected: {}" + alert.getText());
        alert.accept();
    } catch (Exception e) {
    }

The problem is that if there is no alert on the current state of the web page, it waits for a specific amount of time until the timeout is reached, then throws an exception and therefore the performance is really bad.
 public void checkAlert() {
    try {
        WebDriverWait wait = new WebDriverWait(driver, 2);
        wait.until(ExpectedConditions.alertIsPresent());
        Alert alert = driver.switchTo().alert();
        alert.accept();
    } catch (Exception e) {
        //exception handling
    }
}

Saturday 10 May 2014

What is the difference between Thread.Sleep() and Selenium.setSpeed()?

Selenium.setSpeed:
1. takes a single argument in string format
ex: selenium.setSpeed(“2000″) – will wait for 2 seconds
2. Runs each command in after setSpeed delay by the number of milliseconds mentioned in setSpeed.
Thread.sleep:
1. takes a single argument in integer format
ex: thread.sleep(2000) – will wait for 2 seconds
2. Waits for only once at the command given at sleep.

Is it possible to use Selenium for multi-user Load Testing?

Yes, but it requires a LOT of hardware. We recommend you check out BrowserMob, which does load testing with real browsers and is powered by Selenium.

Thursday 8 May 2014

What are the features of TestNG?

 What are the features of TestNG?
TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing (testing a class in isolation of the others) to integration testing (testing entire systems made of several classes, several packages and even several external frameworks, such as application servers). You can use test suite,annotations, automatically generation of report and much more.

What are desired capabilities of Selenium-WebDriver?

What are desired capabilities?

Desired Capabilities help to set properties for the Web Driver. A typical use case would be to 
set the path for the Firefox Driver if your local installation doesn't correspond to the default 
settings.

Click here read In detailed about desired capabilities

Saturday 3 May 2014

Downloading files can be automated by using a simple java program with Selenium as well

Selenium is not a tool for saving attachments etc. But  you can  solve your problem. Simple example:

    @Test
    public void downloadFromIbmlalala() throws AWTException {   
        driver = new FirefoxDriver();
        driver.get(baseUrl);
        try {
        WebElement buttonFromPage = driver.findElement(By.name("verify"));
        buttonFromPage.click();
        (new Robot()).keyPress(java.awt.event.KeyEvent.VK_ENTER);
    } catch (AWTException e) {
        e.printStackTrace();
    }
    }

and attachment is saved in default location. If it’s a good idea to save attachments in automations testing? Don’t think so… But it can be done

Browser pop-ups or file uploads can be handled using Java API Robot class

Selenium is not a tool for saving attachments etc. But  you can  solve your problem. Simple example:

    @Test
    public void downloadFromIbmlalala() throws AWTException {   
        driver = new FirefoxDriver();
        driver.get(baseUrl);
        try {
        WebElement buttonFromPage = driver.findElement(By.name("verify"));
        buttonFromPage.click();
        (new Robot()).keyPress(java.awt.event.KeyEvent.VK_ENTER);
    } catch (AWTException e) {
        e.printStackTrace();
    }
    }

and attachment is saved in default location. If it’s a good idea to save attachments in automations testing? Don’t think so… But it can be done

Thursday 1 May 2014

What is the primary feature of the Web Driver?

The primary new feature in Selenium 2.0 is the integration of the WebDriver API. WebDriver is designed to provide a simpler, more concise programming interface in addition to addressing some limitations in the Selenium-RC API. Selenium-WebDriver was developed to better support dynamic web pages where elements of a page may change without the page itself being reloaded. WebDriver’s goal is to supply a well-designed object-oriented API that provides improved support for modern advanced web-app testing problems.

What is Regression Tesing?

Regression testing is a type of software testing that seeks to uncover new software bugs, or regressions, in existing functional and non-functional areas of a system after changes such as enhancements, patches or configuration changes, have been made to them.
The intent of regression testing is to ensure that a change such as those mentioned above has not introduced new faults. One of the main reasons for regression testing is to determine whether a change in one part of the software affects other parts of the software
Common methods of regression testing include rerunning previously completed tests and checking whether program behaviour has changed and whether previously fixed faults have re-emerged. Regression testing can be performed to test a system efficiently by systematically selecting the appropriate minimum set of tests needed to adequately cover a particular change.

Wednesday 23 April 2014

Ads popup handling code

Set<String> windowId = cDriver.getWindowHandles();    // get  window id of current window
            Iterator<String> itererator = windowId.iterator(); 

            String mainWinID = itererator.next();
            String  newAdwinID = itererator.next();

            cDriver.switchTo().window(newAdwinID);
            System.out.println(cDriver.getTitle());
            Thread.sleep(3000);
            cDriver.close();

            cDriver.switchTo().window(mainWinID);
            System.out.println(cDriver.getTitle());
            Thread.sleep(2000);

Major advantages of Selenium webdriver over Selenium RC.

Selenium uses JavaScript to automate web pages. This lets it interact very tightly with web content, and was one of the first automation tools to support Ajax and other heavily dynamic pages. However, this also means Selenium runs inside the JavaScript sandbox. This means you need to run the Selenium-RC server to get around the same-origin policy, which can sometimes cause issues with browser setup.
WebDriver on the other hand uses native automation from each language. While this means it takes longer to support new browsers/languages, it does offer a much closer ‘feel’ to the browser. If you’re happy with WebDriver, stick with it, it’s the future. There are limitations and bugs right now, but if they’re not stopping you, go for it.
Selenium Benefits over WebDriver
  • Supports many browsers and many languages, WebDriver needs native implementations for each new languagte/browser combo.
  • Very mature and complete API
  • Currently (Sept 2010) supports JavaScript alerts and confirms better

Benefits of WebDriver Compared to Selenium

  • Native automation faster and a little less prone to error and browser configuration
  • Does not Requires Selenium-RC Server to be running
  • Access to headlessHTMLUnit can allow really fast tests
  • Great API