# Eclipse and TestNG

I was playing around with Eclipse and TestNG, the thing you need/want to do is, after you have installed testng via de Eclipse market place and restart Eclipse to go to the project build path.

So right click the project and select from the popup menu Build Path » Configure Build Path...

In this window, make sure you have selected the Libraries tab in the right-hand side of the window.

Next select Add Library... and from the resulting window that pops up select TestNG (or JUnit).

When you select Next or Finish (depending whether you picked TestNG or JUnit), you will then see TestNG under the JRE System Library entry as another library entry. If you expand this you see the testng.jar being included and pointing to the right jar file that’s in Eclipse’s plugins directory.

When you now press OK you should see the imports getting resolved.

You will need to remove any external jar dependencies for TestNG or JUnit of course, because it’s double and will most likely lead to problems.

Now, when you go to Run » Run Configurations... you see a TestNG (JUnit) entry. When you select that entry and create a new configuration underneath it, it should already resolve everything you need (classes, packages, and so on).

Oh, do keep in mind that you will have to mark the test folder as a source folder for it all to work. Right click the folder, select Build Path » Use as Source Folder.

# Setting up Eclipse 4.2 as I like it

Download Eclipse 4.2 Classic 64-bits version from the Eclipse website. Extract the contents to a location, such as C:\Eclipse. Adjust the eclipse.ini in that directory according to my post in order to pin it to the taskbar.

Next, within Eclipse, go to Window » Preferences » Install/Update » Available Software Sites » Add... and add the following URL under something like “4.2-M builds”: http://download.eclipse.org/eclipse/updates/4.2-M-builds. After adding you can hit Reload to reload the information from the website. Exit all windows through pressing OK. Then follow up by going to Help » Check for Updates and you will most likely get an Eclipse SDK update right away. Accept the licensing terms and wait until it downloaded and installed everything and restart Eclipse.

Go to Help » Install New Software... » Work with, select the Juno entry and from the resulting list of software select General Purpose Tools » Marketplace Client followed by Next » Next, accept the license and Finish. Restart Eclipse when done. Now under Help is an entry called the Eclipse Marketplace.

Open the Eclipse Marketplace and search for and install the following: “code recommenders”, “MercurialEclipse”, “mylyn” (not selecting the Bugzilla connector). It might ask if it is OK to install unsigned content, acknowledge it.

You can enable support for certain forward version features via the android.support namespace. In order to accomplish this you need to start the Android SDK Manager and make sure that under the Extras heading you select and install the Android Support package.
Once done you go into the directory extras/android/support/v4 and copy the android-support-v4.jar to your own project’s libs directory. Next go within IntelliJ IDEA to File » Project Structure and under Project Settings go to Modules, make sure your application is selected in the middle pane, then on the right side select the Dependencies tab. In the window below click the plus-icon and select Jars or directories. From the resulting window browse to your libs directory and select the android-support-v4.jar and press OK to close the window and add the jar-file to the dependencies of the project. Since you are now using certain constants from a newer version of Android the Module SDK needs to be changed to Android 4.0.3 Platform as well. Press Apply and close the Project Settings by pressing the OK button.