51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 933|回复: 4
打印 上一主题 下一主题

项目引入swagger,单元测试如下异常,有谁遇到过吗?

[复制链接]
  • TA的每日心情
    擦汗
    前天 09:07
  • 签到天数: 527 天

    连续签到: 4 天

    [LV.9]测试副司令

    跳转到指定楼层
    1#
    发表于 2019-12-30 13:18:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    1测试积点
    项目引入swagger,单元测试如下异常,有谁遇到过吗?
    1. 2019-05-12 23:27:10.597  WARN 11676 --- [           main] o.s.b.t.m.w.SpringBootMockServletContext : Couldn't determine real path of resource class path resource [META-INF/resources/]

    2. java.io.FileNotFoundException: class path resource [META-INF/resources/] cannot be resolved to absolute file path because it does not reside in the file system: jar:file:/C:/Users/chiangfai/.gradle/caches/modules-2/files-2.1/io.springfox/springfox-swagger-ui/2.9.2/d542382a88ff3ea8d4032c28b2b0325797fada7d/springfox-swagger-ui-2.9.2.jar!/META-INF/resources/
    3.     at org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:217) ~[spring-core-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    4.     at org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:131) ~[spring-core-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    5.     at org.springframework.mock.web.MockServletContext.getRealPath(MockServletContext.java:457) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    6.     at org.beetl.ext.spring.BeetlGroupUtilConfiguration.setServletContext(BeetlGroupUtilConfiguration.java:161) [beetl-2.9.8.jar:na]
    7.     at org.springframework.web.context.support.ServletContextAwareProcessor.postProcessBeforeInitialization(ServletContextAwareProcessor.java:108) [spring-web-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    8.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:416) [spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    9.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1686) [spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    10.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573) [spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    11.     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) [spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    12.     at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) [spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    13.     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    14.     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) [spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    15.     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) [spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    16.     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) ~[spring-beans-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    17.     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    18.     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:548) ~[spring-context-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    19.     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.0.8.RELEASE.jar:2.0.8.RELEASE]
    20.     at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) ~[spring-boot-2.0.8.RELEASE.jar:2.0.8.RELEASE]
    21.     at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-2.0.8.RELEASE.jar:2.0.8.RELEASE]
    22.     at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127) ~[spring-boot-test-2.0.8.RELEASE.jar:2.0.8.RELEASE]
    23.     at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    24.     at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    25.     at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    26.     at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    27.     at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    28.     at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    29.     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    30.     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    31.     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) ~[junit-4.12.jar:4.12]
    32.     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    33.     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    34.     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    35.     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) ~[junit-4.12.jar:4.12]
    36.     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) ~[junit-4.12.jar:4.12]
    37.     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) ~[junit-4.12.jar:4.12]
    38.     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) ~[junit-4.12.jar:4.12]
    39.     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) ~[junit-4.12.jar:4.12]
    40.     at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    41.     at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    42.     at org.junit.runners.ParentRunner.run(ParentRunner.java:363) ~[junit-4.12.jar:4.12]
    43.     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) ~[spring-test-5.0.12.RELEASE.jar:5.0.12.RELEASE]
    44.     at org.junit.runner.JUnitCore.run(JUnitCore.java:137) ~[junit-4.12.jar:4.12]
    45.     at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) ~[junit-rt.jar:na]
    46.     at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) ~[junit-rt.jar:na]
    47.     at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) ~[junit-rt.jar:na]
    48.     at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) ~[junit-rt.jar:na]
    复制代码


    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    前天 10:10
  • 签到天数: 1516 天

    连续签到: 5 天

    [LV.Master]测试大本营

    2#
    发表于 2019-12-31 11:10:50 | 只看该作者
    绝对路径未找到
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    前天 09:46
  • 签到天数: 991 天

    连续签到: 5 天

    [LV.10]测试总司令

    3#
    发表于 2019-12-31 12:04:14 | 只看该作者
    应该是jar包没有引入吧
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    前天 07:28
  • 签到天数: 2812 天

    连续签到: 5 天

    [LV.Master]测试大本营

    4#
    发表于 2019-12-31 12:06:22 | 只看该作者
    感觉路径有问题
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    前天 08:56
  • 签到天数: 361 天

    连续签到: 5 天

    [LV.8]测试军长

    5#
    发表于 2019-12-31 12:38:56 | 只看该作者
    测试的部分不用引入swagger的包
    回复

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-17 00:19 , Processed in 0.065310 second(s), 21 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表