REST ASSURED API自动化运行时错误

时间:2019-05-04 18:50:33

标签: java json rest rest-assured scribe

我下载了jar,并在Build路径中传递了“ scribejava-apis-2.5.3”和“ scribejava-core-4.2.0”


代码如下:

public class Basicfunc {

String Consumerkeys= "******************";
String Consumersecretkeys="************";
String Token="**********_*^%&-**************";
String Tokensecret="*********************";


@Test
public void getLatestTweet(){

    RestAssured.baseURI = "https://api.twitter.com/1.1/statuses";
    Response res = given().auth().oauth(Consumerkeys, Consumersecretkeys, Token, Tokensecret).
    queryParam("count","1").
    when().get("/home_timeline.json").then().extract().response();


    String response = res.asString();
    System.out.println(response);
    JsonPath js = new JsonPath(response);
    System.out.println(js.getString("text"));

}

}


错误如下:

java.lang.NoClassDefFoundError:com / github / scribejava / core / model / AbstractRequest         在io.restassured.internal.http.AuthConfig.oauth(AuthConfig.java:182)         在io.restassured.internal.http.AuthConfig $ oauth.call(未知来源)         在org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:152)         在io.restassured.authentication.OAuthScheme.authenticate(OAuthScheme.groovy:35)         在io.restassured.authentication.AuthenticationScheme $ authenticate.call(未知源)         在org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)         在io.restassured.internal.RequestSpecificationImpl.sendRequest(RequestSpecificationImpl.groovy:1265)         在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处         在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)         在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         在java.lang.reflect.Method.invoke(Method.java:498)         在org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)         在groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)         在groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)         在groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)         在groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:822)         在io.restassured.internal.RequestSpecificationImpl.invokeMethod(RequestSpecificationImpl.groovy)         在org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:47)         在org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:152)         在io.restassured.internal.filter.SendRequestFilter.filter(SendRequestFilter.groovy:30)         在io.restassured.filter.Filter $ filter $ 0.call(未知来源)         在org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)         在io.restassured.filter.Filter $ filter.call(未知来源)         在io.restassured.internal.filter.FilterContextImpl.next(FilterContextImpl.groovy:72)         在io.restassured.filter.time.TimingFilter.filter(TimingFilter.java:56)         在io.restassured.filter.Filter $ filter.call(未知来源)         在org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:144)         在io.restassured.internal.filter.FilterContextImpl.next(FilterContextImpl.groovy:72)         在io.restassured.filter.FilterContext $ next.call(未知来源)         在org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:136)         在io.restassured.internal.RequestSpecificationImpl.applyPathParamsAndSendRequest(RequestSpecificationImpl.groovy:1749)         在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处         在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)         在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         在java.lang.reflect.Method.invoke(Method.java:498)         在org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)         在groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)         在groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)         在groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)         在groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:822)         在io.restassured.internal.RequestSpecificationImpl.invokeMethod(RequestSpecificationImpl.groovy)         在org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:47)         在org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:57)         在org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:185)         在io.restassured.internal.RequestSpecificationImpl.applyPathParamsAndSendRequest(RequestSpecificationImpl.groovy:1755)         在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处         在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)         在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         在java.lang.reflect.Method.invoke(Method.java:498)         在org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)         在groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)         在groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)         在groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)         在groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:822)         在io.restassured.internal.RequestSpecificationImpl.invokeMethod(RequestSpecificationImpl.groovy)         在org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:47)         在org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:57)         在org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:157)         在org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:185)         在io.restassured.internal.RequestSpecificationImpl.get(RequestSpecificationImpl.groovy:171)         在io.restassured.internal.RequestSpecificationImpl.get(RequestSpecificationImpl.groovy)         在twitter.api.test.Basicfunc.getLatestTweet(Basicfunc.java:25)         在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处         在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)         在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)         在java.lang.reflect.Method.invoke(Method.java:498)         在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(SuiteRunner.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)         在org.testng.TestNG.runSuites(TestNG.java:1049)         在org.testng.TestNG.run(TestNG.java:1017)         在org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)         在org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)         在org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)     引起原因:java.lang.ClassNotFoundException:com.github.scribejava.core.model.AbstractRequest         在java.net.URLClassLoader.findClass(URLClassLoader.java:381)         在java.lang.ClassLoader.loadClass(ClassLoader.java:424)         在sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:335)         在java.lang.ClassLoader.loadClass(ClassLoader.java:357)         ...再加100

0 个答案:

没有答案