Chapter 7: Reusable script and TestNG setup

TestNG is a testing framework inspired from of JUnit and NUnit,with introducing new functionalities that makes it more powerful and easier to use.

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

It is one of the most widely used open source testing framework used in automation testing suite.

In this chapter we will see how to download and install TestNG in eclipse.

Letus have a step by step guidance of installing TestNG in eclipse.

Installing TestNG in Eclipse

Step 1.Launch Eclipse.

  1. On the menu bar, click Help.
  2. Choose the “Install New Software…” option.

Step 2. when we click on install new software It opens Install dialog box.

  1. Enter “http://beust.com/eclipse/” in the Work with box
  2. Click on the Add button.

Step 3. after clicking on Add repository dialog

  1. Enter “TestNG” in Name Text Field
  2. Click on the Add button.

It will search as entered software.

Step 4.

  1. Select the “TestNG” checkbox
  2. Click on the “Next” button.

Step 5.It will give a review of Items to be installed.  After clicking on Next.

Step 6.

  1. Select the radio button “I accept the terms of the license agreement”
  2. Click on the Finish.

It will take time depending on Internet speed.

Step 7.If you meeting a Security warning, just click “Install Anyway”.

Step 8. Wait for the installation to finish. When Eclipse prompts you for a restart, click “Restart now.”

Step 9. After the restart, verify if TestNG was indeed successfully installed. 

Open java directory and check for TestNG.

In this way installation of TestNG in eclipse was done successfully.

See below video to understand how a common test script can be clubbed together and can be put under function.