How to run karate tests from project jar?

只谈情不闲聊 提交于 2021-02-04 07:49:12

问题


I am using karate 0.9.2 with gradle. My project requires to have all karate tests inside src/main/java. So I configured the gradle dependency as ‘compile’ instead of ‘testCompile’ and also modified the sourceSets to point to main instead of test. When I ran my runner class with above configuration I got empty test suite message.

build.gradle snippet:

compile 'com.intuit.karate:karate-junit4:0.9.3'
compile 'com.intuit.karate:karate-apache:0.9.3'

sourceSets {
    test {
        resources {
            srcDir file('src/main/java')
            exclude '**/*.java'
        }
    }
}

Additionally, I have is to run the karate tests from the deployable project jar. Please point me the resources I can refer to achieve the same.


回答1:


Not something we directly support but teams have done this in Spring Boot etc. It should be possible, see if this thread helps: https://github.com/intuit/karate/issues/520

Also you may not need JUnit also: https://github.com/intuit/karate/issues/427

And see the sample project in this ticket as an example: https://github.com/intuit/karate/issues/529



来源:https://stackoverflow.com/questions/56548576/how-to-run-karate-tests-from-project-jar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!