代码之家  ›  专栏  ›  技术社区  ›  KIC

无法在我的spock spring测试中获取应用程序上下文

  •  0
  • KIC  · 技术社区  · 8 年前

    package my.dwh.etl
    
    import my.dwh.DwhApplication
    import groovy.util.logging.Log
    import org.springframework.beans.factory.annotation.Autowired
    import org.springframework.boot.test.context.SpringBootTest
    import org.springframework.context.ApplicationContext
    import spock.lang.Specification
    
        @Log
        @SpringBootTest(classes = DwhApplication.class)
        class ETL_IT extends Specification {
    
            @Autowired
            ApplicationContext context
    
            def "test integration of loading StackedWithHeaderAndAllTypesSource and storing into h2"() {
    
                given:
                def a
    
                when:
                a = 1
    
                then:
                context != null
            }
        }
    
    1 回复  |  直到 8 年前
        1
  •  0
  •   Sukhpal Singh    8 年前

    Spock测试查找名称以后缀结尾的类: Spec [The name of the tested/specified unit]Spec