Intellij IDE本机支持cucumber。但问题是,我正试图在intellij 13.1.4IDE中的android项目上创建并运行黄瓜测试。经过大量的研究,我发现了this教程。但是在遵循它并运行我的测试之后,我得到了以下结果
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.这是我的项目CucumberTest | app | libs | | cucumber-android-1.1.8.jar | cucumber-core-1.1.8.jar | cucumber-html-0.2.3.jar | cucumber-java-1.1.8.jar | gherkin-2.11.2.jar | junit-4.11.jar src | androidTest | | java | | com.test.cucumbertest.app | | MyStepsDefs.java | | RunTest.java | | testclass.feature | main | java | 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);
}
}RunTest.java:
package com.test.cucumbertest.app;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(format = {"pretty", "html:report"})
public class RunTest {
}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
发布于 2014-12-31 17:48:35
我收到了与您提供的信息类似的提示。不同的是我使用的是Android Studio。您可以尝试通过以下方式将检测标记添加到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“
https://stackoverflow.com/questions/25811672
复制相似问题