繁体   English   中英

我在 Eclipse IDE 中运行我的 TestNG 时出错,任何人都可以看看

[英]I have a error while running my TestNG in Eclipse IDE , Can anyone have a look

这是代码:

package myrestassuredpractise;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.testng.annotations.Test;
import io.restassured.RestAssured;
import io.restassured.response.Response;
public class RestAssuredDemo {
@Test
public void getjsondataTest() {  Response response = RestAssured.get("https://samples.openweathermap.org/data/2.5/weather?id=2172797&appid=e8bc3d3d57aeb071425da856a8f2ce43");
int code = response.getStatusCode();
Assert.assertEquals(200, code);
System.out.println(response.asString());    
System.out.println(response.getTimeIn(TimeUnit.MILLISECONDS));  
   }    
}

以下是错误: CODE pom_xml [RemoteTestNG] 检测到 TestNG 版本 6.14.3 [TestNGContentHandler] [WARN] 强烈建议在文件顶部添加“”,否则 TestNG 可能会失败或无法按预期工作。 失败:getMethod java.lang.ExceptionInInitializerError at org.codehaus.groovy.reflection.ClassInfo.isValidWeakMetaClass(ClassInfo.java:284) at org.codehaus.groovy.reflection.ClassInfo.getMetaClassForClass(ClassInfo.java:254) at org.codehaus .groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:310) 在 io.restassured.authentication.NoAuthScheme.$getStaticMetaClass(NoAuthScheme.groovy) 在 io.restassured.authentication.NoAuthScheme。 enter code here (NoAuthScheme.groovy) 在 io.restassured.RestAssured.(RestAssured.java:354) 在 myrestassuredpractise.chapter1.getMethod(chapter1.java:14) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 处enter code here在 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 在 java.lang.reflect.Method.invoke(Unknown Source) 在 org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper) .java:124) 在 org.testng.internal.Invoker.invokeMethod(Invoker.java:583) 在 org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719) 在 org.testng.internal.Invoker.invokeTestMethods( Invoker.java:989) 在 org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) 在 org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) 在 org.testng.TestRunner.privateRun(TestRunner) .java:648) 在 org.testng.TestRunner.run(TestRunner.java:505) 在 org.testng.SuiteRunner.runTest(Sui teRunner.java:455) 在 org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) 在 org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) 在 org.testng.SuiteRunner.run(SuiteRunner.java:364) ) 在 org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 在 org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) 在 org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) 在 org.testng .TestNG.runSuitesLocally(TestNG.java:1137) at org.testng.TestNG.runSuites(TestNG.java:1049) at org.testng.TestNG.run(TestNG.java:1017) at org.testng.remote.AbstractRemoteTestNG。 run(AbstractRemoteTestNG.java:115) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77) 由:groovy.langException.GroovyRuntime : 模块版本冲突。 模块 [groovy-xml 在 3.0.8 版中加载,而您正尝试在 org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$DefaultModuleListener.onModule(MetaClassRegistryImpl.java:510) 处加载 3.0.7 版,位于 org.codehaus。 groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:87) 在 org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java.2runtime.java:81. scanClasspathModulesFrom(ExtensionModuleScanner.java:63) at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:54) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.(MetaClassRegistryImpl.) org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.(MetaClassRegistryImpl.java:86) at groovy.lang.GroovySystem.(GroovySystem.java:37) ... 32 更多

================================================ 默认测试 测试运行:1,失败:1,跳过:0

================================================ 默认套件总数测试运行:1,失败:1,跳过:0

暂无
暂无

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

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