Posts

Junit - Single Run Program

package default; import java.net.URL; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Platform; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; public class Sample {    private WebDriver driver;    @Before   public void setUp() throws Exception {      DesiredCapabilities capability = DesiredCapabilities.chrome();     driver = new RemoteWebDriver(new URL("<Application URL>"),capability);   }    @Test    public void testSample() throws Exception {      driver.get("http://www.google.com");     WebElement element = driver.findElement(By.name("q"));     element.sendKeys("Selenium Junit");     element.submit();      System.out.println("Page title is: " + driver.getTi

QcIntegration.java

This class file is used to  perform operation in QC by  invoking some inbuilt functions specified in the " OtiClient.Jar " file.  So whoever wants to communicate with QC or ALM, they can use this Class file and otiClient.jar file to make their work simple. QcIntegration.java import com.qc.ClassFactory; import com.qc.IBaseFactory; import com.qc.IList; import com.qc.IProjectDescriptor; import com.qc.IRun; import com.qc.IRunFactory; import com.qc.ITDConnection4; import com.qc.ITSTest; import com.qc.ITestSet; import com.qc.ITestSetFolder; import com.qc.ITestSetTreeManager; import com4j.Com4jObject; public class QcIntegration {          public static void sendRequest(String strTestCaseId, String strStatus) {         ITDConnection4 connection=null;                  //QC url         String url = "http://<QCURL>/qcbin";         //username for login         String username = "<QC USERNAME>";         //password for login

TestCaseOne.java

This is a sample selenium java program created to perform some action in the Google page and update the results into QC. This Class is extended by the  QcIntegration.java program which has function to perform operation in QC by  invoking some inbuilt functions specified in the " OtiClient.Jar " file. TestCaseOne.java import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class TestCaseOne extends QcIntegration{     public static void main(String[] args){         /**         * @param args         */         String baseUrl="http://www.google.co.in";         String strSearchKeyword = "test";         String locSearchTextField = "q";         String locSearchButton = "q";         //Need to pass the Test case name         String strTestCaseID = "<TestCaseName>";         String strTestCaseStatus = "";         WebDriver dr

DLL to Jar file conversion

Steps to get OTIClient.jar file to perform operations within QC 1) Open the HP Quality Center in IE browser and navigate to QC Login page 2) Navigate to the local path of the HP folder to get the OTAClient.dll (Mostly the Path would be “C:\Users\<UserName>\AppData\Local\HP\ALM-Client\172\OTAClient.dll”) 3) In order to work with OTA, we need to register that DLL with the system by using below command in the run prompt regsvr32 "C:\Users\<UserName>\AppData\Local\HP\ALM-Client\172\OTAClient.dll" 4) Convert the DLL file into Jar format to support the script integration with QC.       a. Download ‘ com4j.jar file’, downloaded file will be in zip format, so please extract that zip file in some folder.        b. Navigate to the extracted folder in command prompt        c. Enter the following command java -jar tlbimp.jar -o alm -p com.qc "C:\Users\<UserName>\AppData\Local\HP\ALM-Client\172\OTAClient.dll" 

Quality Center integration with Selenium Webdriver

Image
Introduction to HP Application Lifecycle Management/Quality Center: HP ALM formerly known as Quality Center is a Test Management tool to manage entire Quality Assurance and testing process for an organization. Before being called HP Quality center it used to be Mercury Test Director. ALM helps make project management, from requirements to deployment easier. It increases predictability and creates a framework to manage projects from a central repository.   Selenium Webdriver : Selenium WebDriver is a tool for writing automated tests of websites. It aims to mimic the behaviour of a real user, and as such interacts with the HTML of the application. Selenium WebDriver is the successor to Selenium RC. Selenium WebDriver accepts commands (sent in Selenese, or via a Client API) and sends them to a browser. This is implemented through a browser-specific browser driver, which sends commands to a browser, and retrieves results Selenium 2.0 aims to provide a basic set of building bloc

BrowserMob with Selenium for Performance Test

BrowserMob Proxy BrowserMob Proxy is a simple utility that help to capture the performance data from browsers and also to manipulate the network traffic. We can integrate BrowserMob utility with our selenium webdriver to get performance related data since Browsermob proxy is one of the proxy that has been closely integrated with Selenium Webdriver. Features: The proxy is programmatically controlled via a REST interface or being embedded directly inside Java-based programs. It captures performance data in the HAR format. HAR (HTTP Archive) is a online tool visualizing. HAR is produced by the HTTP tracking tools, these files captures the details of the client/server communication and this can be used for Performance analysis. You can view the HAR file contents by uploading the HAR extension file in the below website http://pcapperf.appspot.com/ Selenium WebDriver - Browsermob Proxy Integration I would like to explain how to integrate Selenium Webdriver with browsermob proxy using java.

Selenium Webdriver : Junit Testing Framework - Single Run and Parallel Run

Java has several popular testing frameworks, and we have provided examples on Junit Testing Framework & how to use them in conjunction with Automate. JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of a family of unit testing frameworks which is collectively known as xUnit that originated with SUnit. JUnit is linked as a JAR at compile-time; the framework resides under package junit.framework for JUnit 3.8 and earlier, and under package org.junit for JUnit 4 and later. Junit - Single run  Program Junit - Parallelrun Program