testing - How to get resource in tests using Gradle? -
i have:
--src -----main -----test --------resources -------------test.zip
in test directory have spock test. how can refer test.zip file pass absolute path test , check of methods? tried new file('.').absolutepath want find better solution
def "check checktypezipmethod"() { expect: assert testedmethod(new file('.').absolutepath+"test/resources/test.zip")==true }
you can either try locate zip file based on classloader#getresource
, or configure test
task set system property pointing zip file. latter easier implement, harder make work in environments other gradle (e.g. when running test inside ide).
ps: in spock expect:
or then:
block, can (and should) omit assert
keyword.
Comments
Post a Comment