Intellij IDE obsługuje natywnie ogórek. Ale problem polega na tym, że próbuję utworzyć i uruchomić test ogórka na projektach android w intellij 13.1.4 IDE. Po wielu badaniach natknąłem się to seminarium. Ale po śledzeniu i przeprowadzeniu testu otrzymuję wyniki
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.
Taka jest struktura mojego projektu
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
Co ja robię źle?
to jest mój 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>
Używam stopniowania
Odpowiedzi:
1 dla odpowiedzi № 1Otrzymałem podobne wiadomości, jak podałeś. Innym jest korzystanie z Android Studio. Możesz spróbować dodać tag oprzyrządowania do swojego pliku AndroidManifest.xml
<instrumentation
android:name="cucumber.api.android.CucumberInstrumentation"
android:targetPackage="com.test.cucumbertest.app"
/>
Jednak wydaje mi się, że masz literówkę w wysłanej wiadomości ?? („com.test.cucumbertest.apptest” => „com.test.cucumbertest.app.test”)
Jeśli błąd nadal jest wyświetlany, być może będziesz musiał zmienić nazwę pakietu testowego na „com.test.cucumbertest.app.test”