首页 > 其他 > 详细

RestAssured 接口测试框架-环境搭建遇到的问题(1)

时间:2020-08-02 23:58:19      阅读:127      评论:0      收藏:0      [点我收藏+]

使用RestAssured接口测试框架在运行用例时出现了下面这个问题:

 1 八月 02, 2020 11:07:14 下午 org.aspectj.weaver.tools.Jdk14Trace error
 2 严重: org/codehaus/groovy/runtime/callsite/AbstractCallSite
 3 java.lang.RuntimeException: bad non-abstract method with no code: void org.codehaus.groovy.runtime.callsite.AbstractCallSite.<init>(org.codehaus.groovy.runtime.callsite.CallSiteArray, int, java.lang.String) on public class org.codehaus.groovy.runtime.callsite.AbstractCallSite
 4     at org.aspectj.weaver.bcel.LazyMethodGen.<init>(LazyMethodGen.java:223)
 5     at org.aspectj.weaver.bcel.LazyClassGen.<init>(LazyClassGen.java:362)
 6     at org.aspectj.weaver.bcel.BcelObjectType.getLazyClassGen(BcelObjectType.java:563)
 7     at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1706)
 8     at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1657)
 9     at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1422)
10     at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1196)
11     at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:551)
12     at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:387)
13     at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:116)
14     at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:51)
15     at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
16     at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
17     at java.lang.ClassLoader.defineClass1(Native Method)
18     at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
19     at java.lang.ClassLoader.defineClass(ClassLoader.java:642)
20     at org.codehaus.groovy.reflection.SunClassLoader.define(SunClassLoader.java:94)
21     at org.codehaus.groovy.runtime.callsite.GroovySunClassLoader.loadAbstract(GroovySunClassLoader.java:72)
22     at org.codehaus.groovy.runtime.callsite.GroovySunClassLoader.<init>(GroovySunClassLoader.java:54)
23     at org.codehaus.groovy.runtime.callsite.GroovySunClassLoader.<init>(GroovySunClassLoader.java:49)
24     at org.codehaus.groovy.runtime.callsite.GroovySunClassLoader.lambda$static$0(GroovySunClassLoader.java:40)
25     at java.security.AccessController.doPrivileged(Native Method)
26     at org.codehaus.groovy.runtime.callsite.GroovySunClassLoader.<clinit>(GroovySunClassLoader.java:37)
27     at org.codehaus.groovy.runtime.callsite.CallSiteGenerator.isCompilable(CallSiteGenerator.java:256)
28     at org.codehaus.groovy.reflection.CachedMethod.createStaticMetaMethodSite(CachedMethod.java:312)
29     at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.createStaticMetaMethodSite(StaticMetaMethodSite.java:112)
30     at groovy.lang.MetaClassImpl.createStaticSite(MetaClassImpl.java:3500)
31     at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:74)
32     at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:156)
33     at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
34     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
35     at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:130)
36     at io.restassured.internal.common.assertion.AssertParameter.notNull(AssertParameter.groovy:21)
37     at io.restassured.config.SSLConfig.<init>(SSLConfig.java:192)
38     at io.restassured.config.SSLConfig.<init>(SSLConfig.java:184)
39     at io.restassured.config.RestAssuredConfig.<init>(RestAssuredConfig.java:41)
40     at io.restassured.RestAssured.<clinit>(RestAssured.java:421)
41     at test_api.lotto.LottoTest.testLotto_02(LottoTest.java:21)
42     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
43     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
44     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
45     at java.lang.reflect.Method.invoke(Method.java:498)
46     at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
47     at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:115)
48     at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:170)
49     at org.junit.jupiter.engine.execution.ThrowableCollector.execute(ThrowableCollector.java:40)
50     at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:166)
51     at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:113)
52     at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:58)
53     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:112)
54     at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
55     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
56     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
57     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:120)
58     at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
59     at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
60     at java.util.Iterator.forEachRemaining(Iterator.java:116)
61     at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
62     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
63     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
64     at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
65     at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
66     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
67     at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
68     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:120)
69     at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
70     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
71     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
72     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$2(HierarchicalTestExecutor.java:120)
73     at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
74     at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
75     at java.util.Iterator.forEachRemaining(Iterator.java:116)
76     at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
77     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
78     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
79     at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
80     at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
81     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
82     at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
83     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.lambda$executeRecursively$3(HierarchicalTestExecutor.java:120)
84     at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66)
85     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.executeRecursively(HierarchicalTestExecutor.java:108)
86     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor$NodeExecutor.execute(HierarchicalTestExecutor.java:79)
87     at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:55)
88     at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:43)
89     at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
90     at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
91     at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
92     at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
93     at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
94     at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
95     at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
96     at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
97     at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)

在试了多种方法后,发现在修改“rest-assured”依赖的版本为“4.2.0”后不会出现这个问题。

原来版本为:

<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>4.3.1</version>
            <scope>test</scope>
        </dependency>

修改为:

<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
    <groupId>io.rest-assured</groupId>
    <artifactId>rest-assured</artifactId>
    <version>4.2.0</version>
    <scope>test</scope>
</dependency>

 

RestAssured 接口测试框架-环境搭建遇到的问题(1)

原文:https://www.cnblogs.com/zhap/p/13423819.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!