Road to handle file download popup in webdriver using Sikuli

In this post I will show you how to integrate webdriver test script with Sikuli automation tool to handle window popup utility like file download and upload etc.
Here I take example of a file download window popup utility, which we can not handle by using webdriver functions. Some people use different-2 automation tool like AutoIt, java Robot class to handle this.
Here is an example of webdriver sikuli integration to handle below selenium jar file download window popup utility.

Some Webdriver API functions in java and its implementation

Following are the some API functions and it implementation
1. How to click on element: By using click() function we perform click operation on page element:

WebElement el  =  driver.findElement(By.id("ElementID"));
el.click();

2. How to enter text into page element: By using sendkeys() function we enter text in page element such as text field, area etc:

WebElement el  =  driver.findElement(By.id("ElementID"));
el.clear(); //use to clear input field
el. sendKeys (“User name”);

3. How to count total number rows in table:

List rows = driver.findElements(By.className("//table[@id='tableID']/tr"));
int totalRow = rows.size();


Road to data driven testing in SoapUI from csv file

In this post I will show you how to execute SoapUI test for a set of values. For this I have put all data in csv file. I write groovy scripts for reading data from csv and executing the test steps.
Below is the groovy script for reading data from “URL.csv” file where I put all user credentials.

def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)

def csvFilePath = "D:\\URL.csv"
context.fileReader = new BufferedReader(new FileReader(csvFilePath))

rowsData = context.fileReader.readLines()
int rowsize = rowsData.size()

for(int i =0;  I < rowsize;  i++)
{

    rowdata = rowsData[i]
    String[] data = rowdata.split(",")
    log.info data[1]
   
    groovyUtils.setPropertyValue("Login", "UserName", data[0])
    groovyUtils.setPropertyValue("Login", "Pass", data[1])
    testRunner.runTestStepByName( "Login")  
}

In above code I read data from “URL.csv” file and pass user name and password into “UserName “ and “Pass” of Login steps parameters.
“Login”  test step executed by using test runner for every data.

Road to reading data from text file in SoapUI using groovy script

In this post, I am going to show you how to read data from text file in SoapUI. SoapUI Pro has some advance feature which is not in SaopUI as data fetching from external sources so in SoapUI we use Groovy script for that. Following are the peace of groovy script code for reading data from text file.

1. Reading all data from text file.
//reading all txt file at once

File file = new File("D://user.txt")
fileContent = file.getText()                 
log.info fileContent

2. Reading data line by line from text file.
//reading text line by line

File file1 = new File("D://user.txt")
List textLine = file1.readLines()
log.info textLine

3. Reading data randomly of any line from text file.
//reading text randon line number

File file2 = new File("D://user.txt")
List textLine2 = file2.readLines()
rowIndex  =  Math.abs(new Random().nextInt() % 4 + 1)
log.info textLine2[rowIndex]

Road to handle popup window using text in Webdriver

Some times we have not title of pop window so in this case we can identified some unique text (content ) of popup window which is not in other window. Using this text we can switch to pop window. Below are the logic and implemented code.

Road to installation of SoapUI plugin into Eclipse.

Following are the steps to install soapui plug-in into eclipse.
1. Open Eclipse IDE and goto “Help” menu and click on “Install New Software”
2. Click on add button you should see like below window.


3. Enter some text into “name” field as “SoapUI“ and enter url http://www.soapui.org/eclipse/update into “Location” field.
4. Click on “OK” button, you should see below screen and soapUI will display.

Execution of SoapUI project using Junit

In this post I am going to show you how to execute SoapUI project using Junit.
SoapUI provide testrunner class name “SoapUITestCaseRunner” which can be used to run soapui test using java class, maven or ant build tool. We create object of this class in java file and call the run function to execute soapui project.

Steps to create Junit test for soap ui project:
1. Chose any IDE as eclipse or NetBean
2. Add “soapui-4.5.1.jar” from soapui bin folder and soapui lid folder as library to class path of your project (eclipse).
3. Use “SoapUITestCaseRunner” class object to run soapui project as mentioned in below code:

Road to command line execution of soapUI project

We run SoapUI project using SoapUI GUI interface.  SoapUI also provide set off batch files to execute soapUI tests from command line without using SoapUI GUI interface.

Following are the runner scripts inside installed SoapUI bin folder.
1. testrunner.bat : this is use to run functional test using command line.
2. loadtestrunner.bat: This is used to run soapui load testing using command line.
3. mockservicerunner.bat:  This is used to run soapui mock services using command line.
4. toolrunner.bat: This is used to launch soapui tools.
5. securitytestrunner.bat: This command is used to run security tests