Monday, January 31, 2011

Introduction to TestNG

Introduction:

TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalists that make it more powerful and easier to use.

TestNG is a testing framework designed to simply a broad range of testing needs, from unit testing (testing a class in isolation of the others) to in integration testing (testing entire systems made of several classes, several packages and even several external frameworks, such as application servers)

Installing TestNG

Installing TestNG

Downloading and Installing TestNG is same of that of JUnit. (Refer this link before moving further)

1. Download testng-5.9-jdk15.jar file

2. For the purpose of this tutorial, download testng-<version-number>.jar file into C TestNG folder of C drive.

3. Now you have extracted TestNG, you need to add testng-5.9-jdk15.jar to your classpath. This enables the Java compiler to resolve where and what TestNG is.

Installing TestNG in Eclipse IDE

Installing TestNG in Eclipse IDE

Following steps will guide you to install TestNG in Eclipse IDE.

1. Open Eclipse 

2. Click on "Help" menu, select "Install New Software..." (see the following figure)
Figure: Select "Install New Software" from Help menu
3. In the "Install" wizard, click on "Add" button

4. In the "Add Repository" window, enter Name as "TestNG" and Location as "http://beust.com/eclipse", click on "OK" button

5. TestNG will be added into the "Install" wizard, select "TestNG" checkbox and click on "Next" button.

Figure: Install Wizard
6. Click on again "Next" button from "Install Details" page.

7. In the "Review Licenses" page, select "I accept the terms of the license agreement" radio button and click on "OK" button

Eclipse will start installing the latest version of "TestNG"

8. The wizard will ask you to re-start eclipse.

Now, TestNG has installed sucessfully. You can create your unit test cases by using TestNG.