Like us on Facebook

LightBlog

October 26, 2010

Unable run test scripts in Firefox??---Unable to delete file lockfile

October 26, 2010 4
Unable run test scripts in Firefox??---Unable to delete file lockfile
Hi...

Here i want to mention about the problem i faced with Firefox(3.6.*)..I created some test scripts using JUnit and able to run in FF(3.5*). Later i upgraded my FF version to 3.6*..Then i got problem

"Could not start Selenium session: Failed to start new browser session: Unable to delete file C:\WINDOWS\TEMP\customProfileDir1249f05ea902412fa46b6c703435ffe6\parent.lock"


I posted question in Google selenium forums...some friends gave suggestions to delete lock file..etc..But it didn't work.

One day i am searching for the same bug in Google..suddenly i found the answer for that...

Here is how to solve that problem

I resolved this problem by updating the selenium version.


Firefox 3.6 requires Selenium 1.04 or higher. If you are using these versions of Firefox and Selenium to create Internet macros for the Internet application, you will get an error message that s "unable to delete" a file named "parent.lock".
This is fixed by an updated selenium-server.jar file. To put this in place, do the following:
  1. Download the updated selenium-server.jar file.
  2. Remove the existing selenium-server.jar file from lib folder (Contains selenium jar files)
  3. Copy the new selenium-server.jar into the Lib folder
  4. Restart the eclipse
If you want more information go through the link


download the new version of selenium server..it will solve the problem.

Hope this will helpful for the FF users...
Cheers....


Advantages of TestNG overJunit

October 26, 2010 0
Advantages of TestNG overJunit
TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use, such as:

* Annotations.
* Run your tests in arbitrarily big thread pools with various policies available (all methods in their own thread, one thread per test class, etc...).
* Test that your code is multithread safe.
* Flexible test configuration.
* Support for data-driven testing (with @DataProvider).
* Support for parameters.
* Powerful execution model (no more TestSuite).
* Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc...).
* Embeds BeanShell for further flexibility.
* Default JDK functions for runtime and logging (no dependencies).
* Dependent methods for application server testing.

TestNG is designed to cover all categories of tests: unit, functional, end-to-end, integration, etc...

How to do Data Driven Testing using TestNG

October 26, 2010 13
There are many ways to do Data driven tests.I used Excel sheet for reading data and FileInputStream method.

Below script explains you how to Read data from excel sheet and use the data to search google.

I am using Eclipse, selenium RC, TestNG and Excel sheet for this script.


--->Create a Java project in eclipse.
--->Create a new class DatadriventestNG.
--->Paste the below code in Eclipse.
--->Chnage the path of excel file according to your requirement.








Please note that selenium will support only .xls format plese do not forget to change the excel file to .xls if you are using MS-office2007.

Below is the code

package test;

import com.thoughtworks.selenium.*;

import org.openqa.selenium.server.*;
import org.testng.annotations.*;


public class DefaultTNG {
public Selenium selenium;
public SeleniumServer seleniumserver;

  @BeforeClass
  public void setUp() throws Exception {
RemoteControlConfiguration rc = new RemoteControlConfiguration();
seleniumserver = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://");
seleniumserver.start();
selenium.start();
}

@Test
public void testDefaultTNG()throws Exception {
FileInputStream fi=new FileInputStream("F:\\Framework\\testdata\\search.xls");
Workbook w=Workbook.getWorkbook(fi);
Sheet s=w.getSheet(0);
selenium.open("http://www.google.com");
selenium.windowMaximize();
for (int i = 1; i < s.getRows(); i++)
 { 
//Read data from excel sheet
 selenium.type("name=q",s.getCell(0,i).getContents());
 selenium.click("btnG");
 Thread.sleep(1000); } 
}
@AfterClass
 public void tearDown() throws InterruptedException{
selenium.stop();
seleniumserver.stop();
 
 }
 }



 Please let me know if you need more information regarding Data driven testing....


How to do Data Driven Testing using JUnit

October 26, 2010 37
There are many ways to do Data driven tests.I used Excel sheet for reading data and FileInputStream method.

Below script explains you how to Read data from excel sheet and use the data to search google.

I am using Eclipse, selenium RC, Junit and Excel sheet for this script.


--->Create a Java project in eclipse.
--->Create a new class DatadrivenJUnit.
--->Paste the below code in Eclipse.
--->Chnage the path of excel file according to your requirement.







Please note that selenium will support only .xls format plese do not forget to change the excel file to .xls if you are using MS-office2007.

Below is the code


import java.io.FileInputStream;
import jxl.Sheet;
import jxl.Workbook;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import com.thoughtworks.selenium.*;


public class DatadrivenJUnit extends SeleneseTestCase{

public Selenium selenium;
public SeleniumServer seleniumserver;

@BeforeClass
public void setUp() throws Exception {

RemoteControlConfiguration rc = new RemoteControlConfiguration();
rc.setSingleWindow(true);
seleniumserver = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://");
seleniumserver.start();
selenium.start();

}

@Test
public void testDatadrivenJUnit() throws Exception
{
FileInputStream fi=new FileInputStream("F:\\Framework\\testdata\\search.xls");
Workbook w=Workbook.getWorkbook(fi);
Sheet s=w.getSheet(0);
selenium.open("http://www.google.com");
selenium.windowMaximize();
for (int i = 1; i < s.getRows(); i++)
 { //Read data from excel sheet
 selenium.type("name=q",s.getCell(0,i).getContents());
 selenium.click("btnG");
 Thread.sleep(1000); } }
@AfterClass
 public void tearDown() throws InterruptedException{
selenium.stop();
 seleniumserver.stop();
}

 }


 Please let me know if you need more information regarding Data driven testing....


An Introduction to Testing Web Applications with twill and Selenium

Why is Software Testing Important?

October 26, 2010 1
Why is Software Testing Important?
1. To discover defects.


2. To avoid user detecting problems

3. To prove that the software has no faults

4. To learn about the reliability of the software.

5. To avoid being sued by customers

6. To ensure that product works as user expected.

7. To stay in business

8. To detect defects early, which helps in reducing the cost of defect fixing?







What Is Software Testing?

October 26, 2010 0
What Is Software Testing?
Definitions of Software Testing -
•It is the process of Creating, Implementing and Evaluating tests.

•Testing measures software quality

•Testing can find faults. When they are removed, software quality is improved.

•Testing is executing a program with an indent of finding Error/Fault and Failure.

•IEEE Terminology : An examination of the behavior of the program by executing on sample data sets.

•Software testing is a process used to identify the correctness, completeness, and quality of developed computer software. It includes a set of activities conducted with the intent of finding errors in software so that it could be corrected before the product is released to the end users.

• In simple words, software testing is an activity to check whether the actual results match the expected results and to ensure that the software system is defect free.


Summary of the Seven Testing Principles


Principle 1 Testing shows presence of defects
Principle 2 Exhaustive testing is impossible
Principle 3 Early Testing
Principle 4 Defect Clustering
Principle 5 Pesticide Paradox
Principle 6 Testing is context dependent
Principle 7 Absence of errors - fallacy

October 25, 2010

First TestNG script

October 25, 2010 1
First TestNG script
Hi...


Hear is the first TestNG scrit....


package test;

import com.thoughtworks.selenium.*;

import org.openqa.selenium.server.*;
import org.testng.annotations.*;


public class DefaultTNG {
public Selenium selenium;
public SeleniumServer seleniumserver;

@BeforeClass
public void setUp() throws Exception {
RemoteControlConfiguration rc = new RemoteControlConfiguration();
seleniumserver = new SeleniumServer(rc);
selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://");
seleniumserver.start();
selenium.start();
}

@Test
public void testDefaultTNG()throws Exception {

selenium.open("http://www.yahoo.com");
selenium.windowMaximize();
selenium.open("http://www.google.com");
selenium.type("q", "Selenium OpenQA");
selenium.click("btnG");
Thread.sleep(10000);
}
@AfterClass
public void tearDown()throws Exception {
selenium.stop();
seleniumserver.stop();

}
}