0

This is the Code:

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));  
   }    
}

Below is the Error: CODEpom_xml[RemoteTestNG] detected TestNG version 6.14.3 [TestNGContentHandler] [WARN] It is strongly recommended to add "" at the top of your file, otherwise TestNG may fail or not work as expected. FAILED: 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) at io.restassured.authentication.NoAuthScheme.$getStaticMetaClass(NoAuthScheme.groovy) at io.restassured.authentication.NoAuthScheme.enter code here(NoAuthScheme.groovy)enter code here at io.restassured.RestAssured.(RestAssured.java:354) at myrestassuredpractise.chapter1.getMethod(chapter1.java:14) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) at org.testng.internal.Invoker.invokeMethod(Invoker.java:583) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.privateRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:505) at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) at org.testng.SuiteRunner.run(SuiteRunner.java:364) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) at 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) Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-xml is loaded in version 3.0.8 and you are trying to load version 3.0.7 at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$DefaultModuleListener.onModule(MetaClassRegistryImpl.java:510) at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:87) at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:81) at 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) at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.(MetaClassRegistryImpl.java:86) at groovy.lang.GroovySystem.(GroovySystem.java:37) ... 32 more

=============================================== Default test Tests run: 1, Failures: 1, Skips: 0

=============================================== Default suite Total tests run: 1, Failures: 1, Skips: 0

samrac
  • 1
  • 2

0 Answers0