简体   繁体   中英

How to fix the error org.testng.eclipse.maven.MavenTestNGLaunchConfigurationProvider.getClasspath(Lorg/eclipse/debug/core/ILaunchConfiguration;)

I have written a code which just opens an webpage and validates whether the page's title matches with the expected string or not.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;

public class NewTest {
     public String website = "https://opensource-demo.orangehrmlive.com/";
     WebDriver driver = new ChromeDriver();
  @Test
  public void f() {
      String actual = driver.getTitle();
      String expected = "OrangeHRM";
      Assert.assertEquals(actual, expected);
  }
  @BeforeTest
  public void beforeTest() {
      driver.get(website);
  }

  @AfterTest
  public void afterTest() {
      driver.close();
  }

}

Now while running the code there is popup window stating an internal error { An internal error occurred during: "Launching NewTest". org.testng.eclipse.maven.MavenTestNGLaunchConfigurationProvider.getClasspath(Lorg/eclipse/debug/core/ILaunchConfiguration;)Ljava/util/List; }

This error message...

An internal error occurred during: "Launching NewTest"
org.testng.eclipse.maven.MavenTestNGLaunchConfigurationProvider.getClasspath(Lorg/eclipse/debug/core/ILaunchConfiguration;)Ljava/util/List;

...implies that there was incompatibility between TestNG and Maven related classfiles.

Historically, this error would occur if while installing you have kept the checkbox for M2E Maven as checked .

The easiest approach to address this issue would be to reinstall the TestNG ensuring that the checkbox for M2E Maven is kept unchecked .

  1. Open eclipse -> Click on Help -> Click on Installation details -> Search for TestNg M2E(optional) -> Select that and click on Uninstall.
  2. Restart your eclipse and rerun your testNg file.

This is the error you receive for the incompatibility for Eclipse and TestNG and Maven.

Simplest Way to resolve this error is

  1. Open Eclipse
  2. Click on Help
  3. Click on About Eclipse
  4. On this Pop-up click on -> Installed Application
  5. Search TestNG
  6. Select TestNG and click on Checkbox of TestNG M2M(Optional) and Uninstall this component
  7. Restart the Eclipse
  8. This issue is Resolved

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM