ScreenshotNeo

BlogHow-to

How to Install TestNG in Eclipse: Step-by-Step Guide

Install the TestNG plug-in in Eclipse through Marketplace or the official update site, verify it, and configure the separate project dependency.

By the ScreenshotNeo team4 October 20268 min read

To install TestNG in Eclipse, use Eclipse Marketplace or add the official TestNG update site in Help → Install New Software…. Finish the installation wizard and restart Eclipse. Then confirm that the TestNG view appears under Window → Show View → Other… → Java. The Eclipse plug-in adds IDE integration; Maven and Gradle projects still need TestNG in their own build configuration.

1. Check Eclipse and Java requirements

The TestNG Eclipse plug-in documentation states that Eclipse 4.2 or later is required. It specifies Java 11 or later for plug-in versions 7.8.0 and above, and Java 8 for versions through 7.4.0. It does not state the Java requirement for every version between those ranges, so check the exact release requirements if you need one of those versions. Do not assume every Eclipse and plug-in combination is supported.

In Eclipse, you can inspect the running installation and Java runtime from Help → About Eclipse IDE and its installation details. If your environment uses a separate Java runtime for Eclipse than for your project, check both: the plug-in requirement concerns Eclipse’s runtime, while your project’s Java compatibility is controlled by its own build and compiler settings.

2. Choose an installation route

Route Start here Useful when
Eclipse Marketplace TestNG listing in Marketplace You want to find and install the plug-in through Eclipse’s Marketplace workflow.
Official update site Help → Install New Software… You want to enter the official repository directly or intentionally select a version-specific site.

Both routes install the Eclipse plug-in. Neither route automatically adds TestNG as a dependency to a Maven or Gradle project.

3. Install from Eclipse Marketplace

  1. Open the official TestNG Eclipse download page and follow its Eclipse Marketplace link.
  2. In Eclipse Marketplace, use the listing’s Install control. The TestNG instructions also describe dragging the Marketplace Install icon onto the Eclipse workspace.
  3. Review and accept the prompts in Eclipse. Allow the installation wizard to complete.
  4. Restart Eclipse when prompted. Restarting loads the newly installed plug-in.

The names or placement of Marketplace controls can vary with the Eclipse version. Follow the prompts shown by your installation.

4. Install from the official update site

  1. In Eclipse, choose Help → Install New Software….
  2. In the Work with field, enter https://testng.org/testng-eclipse-update-site.
  3. Wait for Eclipse to load the available software. Ensure the checkbox next to the repository entry is selected, then choose Next.
  4. Continue through the installation wizard, review the items and license prompt, and complete installation.
  5. Restart Eclipse when asked.

The official update-site page lists the main release repository and version-specific repository URLs. Use the main release site for a regular install. Choose a version-specific site only when you deliberately need that release, for example to match an existing environment; confirm its requirements rather than relying on an old tutorial’s URL.

5. Verify that Eclipse recognizes TestNG

  1. After restarting Eclipse, open Window → Show View → Other….
  2. Expand the Java category.
  3. Look for and select TestNG, then open the view.

The plug-in documentation also describes File → New → TestNG as an entry point for creating a TestNG class. If these entries are present, Eclipse has loaded the integration. Their presence does not prove that a particular project has the TestNG library on its build path.

6. Add TestNG to the project build

The Eclipse plug-in provides IDE workflows, such as creating TestNG classes and launching tests. A project also needs the framework dependency through its build tool. The official TestNG download page provides Maven and Gradle configuration. Choose the dependency version that fits the project, and check the current official instructions rather than copying an unverified version number.

Maven

Add the TestNG dependency shown on the official download page to the project’s pom.xml. For a typical test-only dependency, place it inside <dependencies> and use test scope as directed by the current TestNG and project configuration. Then refresh or update the Maven project in Eclipse so the IDE resolves the dependency.

<dependencies>
  <dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>REPLACE_WITH_VERSION_FROM_OFFICIAL_TESTNG_DOWNLOAD_PAGE</version>
    <scope>test</scope>
  </dependency>
</dependencies>

Replace the placeholder with the version currently documented for your project. If the project already manages the version in a parent POM or property, follow that convention rather than duplicating a version.

Gradle

Add the dependency coordinate shown on the official download page to the test dependencies in the project’s Gradle build, then refresh Gradle in Eclipse. The exact syntax depends on whether the project uses the Groovy or Kotlin DSL; follow the relevant official example for the selected TestNG version.

// Groovy DSL: build.gradle
// Replace the placeholder with the version from the official TestNG download page.
dependencies {
    testImplementation 'org.testng:testng:REPLACE_WITH_VERSION'
}

test {
    useTestNG()
}
// Kotlin DSL: build.gradle.kts
// Replace the placeholder with the version from the official TestNG download page.
dependencies {
    testImplementation("org.testng:testng:REPLACE_WITH_VERSION")
}

tasks.test {
    useTestNG()
}

These Gradle snippets show the usual test dependency and test-task configuration shape. Check the current TestNG download instructions and your Gradle version before adopting them. If your project does not use Maven or Gradle, configure its build path using the project’s established dependency process.

For Maven-managed projects, the plug-in page describes an optional M2E integration plug-in and recommends it for those projects. It is an optional integration, not a prerequisite for every TestNG project.

7. Create and run a small TestNG test

Once the project dependency is resolved, a minimal test class can confirm that the project can compile and execute TestNG tests:

import org.testng.Assert;
import org.testng.annotations.Test;

public class SmokeTest {
    @Test
    public void additionWorks() {
        Assert.assertEquals(2 + 2, 4);
    }
}

Create the class in the project’s test source folder. In Eclipse, use the TestNG class creation workflow if available, or create a Java class and add the imports and annotation. Run the class using the TestNG run option provided by the plug-in. If Eclipse offers only a generic Java run action or reports missing TestNG imports, check the project dependency and its refresh status.

8. Common installation and setup problems

Symptom Likely cause What to try
Eclipse cannot load the update site Proxy, firewall, or network policy prevents repository access. Check proxy settings and whether the corporate firewall permits access to the official TestNG repository. The official troubleshooting page describes an offline update-site option for environments that cannot reach the online site; it is an alternative to investigate, not a guaranteed fix.
No software is shown after entering the repository The URL was mistyped, not enabled, or failed to load. Use https://testng.org/testng-eclipse-update-site, select the repository checkbox, wait for loading, and retry. Check Eclipse’s error details if it still fails.
The install completes but TestNG does not appear on Windows The Eclipse installation directory may not grant the user sufficient rights. Check that the Eclipse installation folder grants your user full rights, as the TestNG troubleshooting page advises. Restart Eclipse and inspect the Java category in Show View again.
TestNG view is missing after restart The plug-in may not have installed or loaded successfully, or a different Eclipse installation was restarted. Confirm you restarted the same Eclipse installation used for the install. Reopen the installation wizard or review Eclipse installation details and logs for an installation error.
Imports such as org.testng.annotations.Test cannot be resolved The IDE plug-in is installed, but the project dependency is absent or not refreshed. Add TestNG to the Maven or Gradle build, then update/refresh the project and let dependency resolution finish.
Tests compile but Eclipse does not offer TestNG launch options The plug-in may not be loaded, or the class may not be recognized as a TestNG test. Verify the TestNG view and plug-in installation, confirm the class uses TestNG annotations, and refresh the project build configuration.
An old tutorial’s repository URL fails The tutorial may refer to an old or version-specific update site. Start with the official main release update site. Use a versioned repository only when you intentionally need that release.

For official repository connectivity and Windows visibility guidance, see TestNG Eclipse troubleshooting. If a fix does not address the underlying network or permissions issue, consult the Eclipse error details and your organization’s environment settings.

9. Compatibility, performance, and reliability notes

  • Compatibility: The documented baseline is Eclipse 4.2 or later, with the stated Java requirements for plug-in versions 7.8.0 and above and through 7.4.0. The sources do not provide a full matrix for every operating system, Eclipse release, and plug-in version.
  • Install reliability: Marketplace and update-site installs both depend on Eclipse successfully completing the installation. Network restrictions can prevent repository access; an offline route may be relevant in that situation.
  • Project reliability: Keeping TestNG declared in the project build makes the dependency explicit for the build tool and teammates. The IDE plug-in alone is not a substitute for that declaration.
  • Performance: No installation-time or test execution benchmark is established by the cited documentation. Dependency download speed and test runtime depend on the environment and the project.
  • Cost: The cited TestNG installation and dependency documentation does not specify a fee for installing this plug-in. No cost or licensing claim beyond those sources is needed to follow these steps.

10. Or skip the browser setup

If you need a screenshot of a page while documenting the setup, you can capture one with ScreenshotNeo, a website screenshot API and MCP server for developers. It is separate from TestNG and does not install or configure Eclipse.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. Cookie and consent banners, newsletter popups, and chat widgets can be removed before capture. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed; response headers identify the page verdict and billing status. Its MCP server lets AI agents using Claude, Cursor, or another MCP client take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up for 1,000 free screenshots a month, with no card required.

FAQ

Does installing the plug-in install TestNG into every Java project?

No. The plug-in adds Eclipse integration. Each project’s build must declare the framework dependency separately.

Do I need the optional M2E integration plug-in?

No. The TestNG Eclipse plug-in page describes it as optional and recommends it for Maven-managed projects.

Should I use the version-specific update site?

Use the main release site for an ordinary installation. Choose a version-specific site when you deliberately need that plug-in release and have checked its requirements.

Where can I find TestNG’s official installation instructions?

See the TestNG Eclipse download page, the plug-in documentation, and the TestNG documentation.