如何使用cucumber java在intellij 13.1.4中为android项目设置和运行cucumber bdd测试
Intellij IDE以本机方式支持cucumber。但问题是我正试图在Intellij13.1.4IDE中的android项目上创建并运行cucumber测试。 经过大量的研究,我发现了这个教程。但是在遵循它并运行我的测试之后,我得到了这个结果如何使用cucumber java在intellij 13.1.4中为android项目设置和运行cucumber bdd测试,java,android,intellij-idea,Java,Android,Intellij Idea,Intellij IDE以本机方式支持cucumber。但问题是我正试图在Intellij13.1.4IDE中的android项目上创建并运行cucumber测试。 经过大量的研究,我发现了这个教程。但是在遵循它并运行我的测试之后,我得到了这个结果 Running tests Test running startedTest running failed: Unable to find instrumentation info for: ComponentInfo{com.test.cucu
Running tests
Test running
startedTest
running failed: Unable to find instrumentation info for: ComponentInfo{com.test.cucumbertest.apptest/cucumber.api.android.CucumberInstrumentation}
Empty test suite.
这是我项目的结构
黄瓜试验
|应用程序
|自由基
|
|cucumber-android-1.1.8.jar
|cucumber-core-1.1.8.jar
|cucumber-html-0.2.3.jar
|cucumber-java-1.1.8.jar
|小黄瓜-2.11.2.jar
|junit-4.11.jar
src
|雄激素试验
||爪哇
|| com.test.cucumbertest.app
|| MyStepsDefs.java
|| RunTest.java
|| testclass.feature
|主要
|爪哇
|com.test.cucumbertest.app
|MainActivity.java
MyStepDefs.java
package com.test.cucumbertest.app;
import android.test.ActivityInstrumentationTestCase2;
import cucumber.api.PendingException;
import cucumber.api.java.en.Given;
public class MyStepDefs extends ActivityInstrumentationTestCase2<MainActivity>{
public MyStepDefs() {
super(MainActivity.class);
}
@Given("^I have lunch the app$")
public void I_have_lunch_the_app() throws Throwable {
// Express the Regexp above with the code you wish you had
assertTrue(true);
}
}
testclass.feature:
Feature: Test BDD
Scenario: Scenario One
Given I have lunch the app
我做错了什么
这是我的AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.cucumbertest.app" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.test.cucumbertest.app.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
我正在使用gradle我收到了您提供的类似消息。不同的是我使用Android Studio。 您可以尝试通过以下方式将instrumentation标记添加到AndroidManifest.xml中:
<instrumentation
android:name="cucumber.api.android.CucumberInstrumentation"
android:targetPackage="com.test.cucumbertest.app"
/>
但是,我猜您在发布的消息中有输入错误??(“com.test.cucumbertest.apptest”=>“com.test.cucumbertest.app.test”)
如果错误仍然提示,您可能还需要将测试包重命名为“com.test.cucumbertest.app.test”
<instrumentation
android:name="cucumber.api.android.CucumberInstrumentation"
android:targetPackage="com.test.cucumbertest.app"
/>