JUnit测试套件是否适用于Grails?
我正在使用IntelliJ编写Groovy / Grails(2.1.2)项目。
是否可以将Spock测试作为JUnit测试套件运行?我试过了:
package com.foo
import com.foo.functional.SampleFunctionalSpec
import org.junit.experimental.categories.Categories
import org.junit.runner.RunWith
import org.junit.runners.Suite
@RunWith(Categories.class)
@Categories.IncludeCategory(Category1.class)
@Suite.SuiteClasses( {SampleFunctionalSpec.class} )
class SampleTestSuite {
}
和
package com.foo.functional
import com.foo.*
import org.junit.experimental.categories.Category;
@Category(Category1.class)
class SampleFunctionalSpec extends BloomGebSpecCase {
def "Sample test 1 with Category1"() {
given:
when:
println "when"
then:
println "Sample test 1 with Category1"
}
}
和
package com.foo
interface Category1 { }
当我从IntelliJ中运行grails test-app functional SampleTestSuite
时,我得到“无法将测试报告器附加到测试框架......”。
编辑:此外,只运行没有类别的测试套件会产生相同的“未附加”问题:
@RunWith(Suite.class)
@Suite.SuiteClasses( SampleFunctionalSpec.class )
class SampleTestSuite { }