0

这是代码:

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 可能会失败或无法按预期工作。失败:在 org.codehaus.groovy.reflection.ClassInfo.getMetaClassForClass(ClassInfo.java:254) 的 org.codehaus.groovy.reflection.ClassInfo.isValidWeakMetaClass(ClassInfo.java:284) 的 getMethod java.lang.ExceptionInInitializerError .groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:310) 在 io.restassured.authentication.NoAuthScheme.$getStaticMetaClass(NoAuthScheme.groovy) 在 io.restassured.authentication.NoAuthScheme。enter code here(NoAuthScheme.groovy)enter code here GroovyRuntimeException:模块版本冲突。模块 [groovy-xml 在 3.0.8 版中加载,您正尝试在 org.codehaus 的 org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$DefaultModuleListener.onModule(MetaClassRegistryImpl.java:510) 加载 3.0.7 版。 groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:87) 在 org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:81) 在 org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner。 scanClasspathModulesFrom(ExtensionModuleScanner.java:63) at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:54) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.(MetaClassRegistryImpl.java:125) org.codehaus.groovy。

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

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

4

0 回答 0