有人可以帮助我,我无法让步骤定义起作用。我已经拍摄了Andoid Studio工作场所的屏幕截图,因为我认为它更容易解释一切。基本上我想运行功能文件myfeature.feature,当我需要它来获取MyStepdef类中定义的步骤。我确定这很容易解决,但这对我来说已经有好几天了
UPDATE!
我下载了骨架类(如建议的那样),甚至设法在自己的android工作区中运行它。试图用我的程序实现,使用骨架中的类,相同的功能,相同的设置,但不能运行它。
我尝试从头开始创建功能文件,使用android从该功能文件设置stepdefintions但仍然无法运行它
我的想法是,我有一个gradle设置运行另一个自动化测试,其中我有复杂功能,现在我用他发布的“解决方案”完善了它们[//stackoverflow.com/questions/36968728/android -Studio测试库依赖性,也就是说具备的,被-使用编译后的Java / 36975041#36975041]
我觉得与expresso一起使用的自动化测试设置对于黄瓜特征测试来说效果不佳
每当我添加jvm(0.5)并删除exclude语句时,旧错误就会出现bacK
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
Error:1 error; aborting
:app:transformClassesWithDexForDebugAndroidTest FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_74\bin\java.exe'' finished with non-zero exit value 1*
任何时候我将exclude cucumber-jvm-deps应用于dependecny,我可以运行espresso测试但不能运行cucumber.feature - 要么它不能识别步骤,要么运行使用JUnit(如骨架中)运行我收到了一个全新的错误
"C:\Program Files\Java\jdk1.8.0_91\bin\java" -ea -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files\Android\Android Studio\bin" -Didea.junit.sm_runner -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Android\Android Studio\lib\idea_rt.jar;C:\Program Files\Android\Android Studio\plugins\junit\lib\junit-rt.jar;C:\Users\hbill\AppData\Local\Android\sdk\platforms\android-23\android.jar;C:\Users\hbill\AppData\Local\Android\sdk\platforms\android-23\data\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\classes\debug;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-html\0.2.3\624a0c986088e32910336dd77aee5191c04a8201\cucumber-html-0.2.3.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\runner\0.5\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\runner\0.5\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-idling-resource\2.2.2\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-idling-resource\2.2.2\jars\classes.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-library\1.3\4785a3c21320980282f9f33d0d1264a69040538f\hamcrest-library-1.3.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-integration\1.3\5de0c73fef18917cd85d0ab70bb23818685e4dfd\hamcrest-integration-1.3.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.3.0\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.3.0\jars\libs\internal_impl-23.3.0.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.3.0\res;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\com.google.code.findbugs\jsr305\2.0.1\516c03b21d50a644d538de0f0369c620989cd8f0\jsr305-2.0.1.jar;C:\Users\hbill\AppData\Local\Android\sdk\extras\android\m2repository\com\android\support\support-annotations\23.3.0\support-annotations-23.3.0.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-vector-drawable\23.3.0\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\support-vector-drawable\23.3.0\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\animated-vector-drawable\23.3.0\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\animated-vector-drawable\23.3.0\res;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\gherkin\2.12.2\17138631fa20fd0e44a13e50d6b7be59cee1a94\gherkin-2.12.2.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.3.0\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.3.0\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-core\2.2.2\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test.espresso\espresso-core\2.2.2\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\exposed-instrumentation-api-publish\0.5\jars\classes.jar;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\exposed-instrumentation-api-publish\0.5\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\rules\0.5\res;C:\Users\hbill\Documents\TheFoodHunt2\app\build\intermediates\exploded-aar\com.android.support.test\rules\0.5\jars\classes.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\javax.annotation\javax.annotation-api\1.2\479c1e06db31c432330183f5cae684163f186146\javax.annotation-api-1.2.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\javax.inject\javax.inject\1\6975da39a7040257bd51d21a231b76c915872d38\javax.inject-1.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-core\1.2.4\72790b1da44d8d3d2764c6aef29865ee228bbeb1\cucumber-core-1.2.4.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\com.google.guava\guava\17.0\9c6ef172e8de35fd8d4d8783e4821e57cdef7445\guava-17.0.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-junit\1.2.4\8a57b68486cff4da4f10019cb9c62c597a6d2861\cucumber-junit-1.2.4.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-android\1.2.4\cf6fd6b0de808c6b28bf8e9d22f6572a180930a3\cucumber-android-1.2.4.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\com.squareup\javawriter\2.1.1\67ff45d9ae02e583d0f9b3432a5ebbe05c30c966\javawriter-2.1.1.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-core\1.3\42a25dc3219429f0e5d060061f71acb49bf010a0\hamcrest-core-1.3.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-java\1.2.4\57cca534b7abe43f6dd7624b90d3d97d33d3023d\cucumber-java-1.2.4.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\junit\junit\4.12\2973d150c0dc1fefe998f834810d68f278ea58ec\junit-4.12.jar;C:\Users\hbill\.gradle\caches\modules-2\files-2.1\info.cukes\cucumber-jvm-deps\1.0.3\cccdeff234db8b12e91ae2529812f1240b4d5603\cucumber-jvm-deps-1.0.3.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 boo.thefoodhunt.RunCukesTest
!!! JUnit version 3.8 or later expected:
java.lang.RuntimeException: Stub!
at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:5)
at junit.textui.TestRunner.<init>(TestRunner.java:54)
at junit.textui.TestRunner.<init>(TestRunner.java:48)
at junit.textui.TestRunner.<init>(TestRunner.java:41)
at com.intellij.rt.execution.junit.JUnitStarter.junitVersionChecks(JUnitStarter.java:205)
at com.intellij.rt.execution.junit.JUnitStarter.canWorkWithJUnitVersion(JUnitStarter.java:188)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Process finished with exit code -3
现在我讨厌被击败,但我想我只能离开它并以某种方式绕过它(即使它用于测试课程作业:/)因为这花费了我很多时间,并且吃了我的修订版。
我拍摄了我的设置的屏幕截图(如果是快速修复,愚蠢的错误)
TBH关于CLI的建议如下,我不确定是什么意思,因为这是我第一次尝试设置测试环境,我理解它是作为测试的主要活动类型的集合跑? ,但我不知道如何设置它。
成绩构建依赖:
compile 'com.android.support:appcompat-v7:23.3.0'
androidTestCompile('info.cukes:cucumber-java:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile('info.cukes:cucumber-junit:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile('info.cukes:cucumber-core:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile 'junit:junit:4.12'
compile 'com.android.support:support-annotations:23.3.0'
compile 'com.google.guava:guava:17.0'
androidTestCompile 'com.android.support:support-annotations:23.3.0'
compile 'info.cukes:gherkin:2.12.2'
// androidTestCompile 'com.android.support.test:runner:0.4.1'
androidTestCompile('info.cukes:cucumber-android:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'info.cukes:cucumber-jvm:1.2.4'
androidTestCompile('info.cukes:cucumber-html:0.2.3') {
exclude module: 'cucumber-jvm-deps'
}
compile 'info.cukes:cucumber-jvm-deps:1.0.3'
答案 0 :(得分:0)
您看到的消息是步骤未定义但已实现了存根。
这告诉我你实现存根的地方不在类路径的正确部分。胶水可能有问题。
您希望这些步骤与测试运行器位于同一个包或子包中。那是你调用Cucumber跑步者的类。
我会考虑添加一个注释为https://github.com/cucumber/cucumber-java-skeleton的JUnit类来运行Cucumber。
radio button
请注意,此类必须位于测试类路径中。
这与您使用CLI调用Cucumber的当前方法不同。