2016-05-02 5 views
0

誰かが私を助けてください、私は動作するようにステップ定義を得ることができない場合があります。私はAndoid Studioの職場のスクリーンショットを撮りました。私はそれがすべて簡単に説明できると思っていました。基本的には、フィーチャー・ファイルmyfeature.featureを実行したいときに、MyStepdefクラスで定義されているステップを拾いたいと思っています。私はそれが簡単な修正だと確信していますが、これは数日の間私のために働いていませんなぜ私のキュウリの機能が実行されていません

UPDATE!

スケルトンクラスをダウンロードし(推奨)、自分のアンドロイドワークスペースで実行することさえできました。私のプログラムで実装しようとしましたが、スケルトンのクラス、同じ機能、同じ設定を使用しましたが、実行できません。

私はまだその機能ファイルからstepdefintionsを設定するには、Android使用とすると、

私の考えは、私は他の自動テストを実行するためのGradleを設定しているということです、それを実行することはできません、最初から機能ファイルを作成しようとしました私は合併症を抱えていましたが、今では私が投稿した "ソリューション"で完璧なものになっています[//stackoverflow.com/questions/36968728/android-studio-testing-library-dependencies-that-have-been-compiled-using- java/36975041#36975041]
私は、expressoでうまく動作する自動テスト設定がキュウリの機能テストでうまく動作しないと感じています。
いつでも私は、JVM(0.5)を追加し、古いエラーが戻っ

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* 

私はdependecnyにキュウリ-JVM-depsのを除外適用いつでも来る、私はエスプレッソテストを実行することはできませんが、除外ステートメントを削除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 

は、今私は敗北することを憎む全く新しいエラーが出るが、私はイムだけで行くと思います何とかそれを残して周りを回らなければならない(これは、コースのテストのためのものでも:)わたしのリビジョンに食べる。

私は

JUnit - Run Setup

Cucumber Feature Setup

TBHに(、クイックフィックスの場合は愚かな過ちを)CLIに関する以下の提案を私の設定のスクリーンショットを取ってきた、私はわからないんだけどテスト環境をセットアップしようとしたのは初めてのことですが、テストのメインアクティビティの一種として設定されていると理解していますか?しかし、私はそれを他の方法で設定する方法を知らない。

グレードのビルドdependcies:

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

スクリーンショットはリンクにありますが、私の質問に画像を埋め込むにはまだポイントに達していません。 – Boo

答えて

0

ご覧メッセージが手順が定義されていないが、スタブを実装しているということです。

これは、あなたがスタブを実装した場所がクラスパスの正しい部分にないことを示しています。あなたの接着剤にはおそらく何か問題があります。

ステップをテストランナーと同じパッケージまたはサブパッケージに入れたいとします。それはキュウリランナーを呼び出すクラスです。

キュウリを実行するためにhttps://github.com/cucumber/cucumber-java-skeletonに注釈が付けられたJUnitクラスを追加することを検討します。

@RunWith(Cucumber.class) 
public class RunCukesTest { 
} 

このクラスはテストクラスパス内にある必要があります。

これは、CLIを使用してCucumberを呼び出す現在の方法とは異なります。

+0

トーマス!こんにちは、もう一度あなたの助けに感謝します。私はgoを持っています – Boo

+0

あなたの時間のおかげで、そのような幸運なトーマスはありません、私はスケルトンを自分のスタジオワークスペースで走らせることができましたが、私のプロジェクトにそれを適用することはまだ行っていませんでした。私は更新しましたが、私はこのソートされた今夜または明日の迅速な修正を得ることができない限り、私はキュウリにミスを与えなければならないでしょう:( – Boo

関連する問題