简体   繁体   English

如何修复错误

[英]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".现在在运行代码时会弹出 window 说明内部错误 { 期间发生内部错误:“启动 NewTest”。 org.testng.eclipse.maven.MavenTestNGLaunchConfigurationProvider.getClasspath(Lorg/eclipse/debug/core/ILaunchConfiguration;)Ljava/util/List; org.testng.eclipse.maven.MavenTestNGLaunchConfigurationProvider.getClasspath(Lorg/eclipse/debug/core/ILaunchConfiguration) } }

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. ...暗示TestNGMaven相关的类文件之间存在不兼容

Historically, this error would occur if while installing you have kept the checkbox for M2E Maven as checked .从历史上看,如果在安装时将M2E Maven的复选框保持为选中状态,则会发生此错误。

The easiest approach to address this issue would be to reinstall the TestNG ensuring that the checkbox for M2E Maven is kept unchecked .解决此问题的最简单方法是重新安装TestNG ,确保未选中M2E Maven的复选框。

  1. Open eclipse -> Click on Help -> Click on Installation details -> Search for TestNg M2E(optional) -> Select that and click on Uninstall.打开 eclipse -> 点击帮助 -> 点击安装详细信息 -> 搜索 TestNg M2E(可选) -> Select 并点击卸载。
  2. Restart your eclipse and rerun your testNg file.重新启动 eclipse 并重新运行 testNg 文件。

This is the error you receive for the incompatibility for Eclipse and TestNG and Maven.这是由于 Eclipse 和 TestNG 和 Maven 不兼容而收到的错误。

Simplest Way to resolve this error is解决此错误的最简单方法是

  1. Open Eclipse打开 Eclipse
  2. Click on Help点击帮助
  3. Click on About Eclipse点击关于 Eclipse
  4. On this Pop-up click on -> Installed Application在此弹出窗口中单击 -> 已安装的应用程序
  5. Search TestNG搜索 TestNG
  6. Select TestNG and click on Checkbox of TestNG M2M(Optional) and Uninstall this component Select TestNG 并单击 TestNG M2M(可选)的复选框并卸载此组件
  7. Restart the Eclipse重启Eclipse
  8. This issue is Resolved此问题已解决

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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