sebaslogen / CleanGUITestArchitecture

Sample project of Android GUI test automation using Espresso, Cucumber and the Page Object Pattern
MIT License
137 stars 31 forks source link

Questions : no test were found #13

Closed BuddyArifin closed 7 years ago

BuddyArifin commented 7 years ago

Hey,

I try implement to my project, but still have an error "no test were found, Test running failed: Instrumentation run failed due to 'cucumber.runtime.CucumberException'". I already read this thread #3, but still i cannot solve this error. I would greatly appreciate it if you could tell me what I'm doing wrong

Structure folder

screen shot 2017-05-15 at 11 33 37 am

CucumberTestRunner `@Override public void onCreate(final Bundle bundle) { super.onCreate(bundle); final String tags = sea.olxsulley.BuildConfig.TEST_TAGS; if (!tags.isEmpty()) { bundle.putString(CUCUMBER_TAGS_KEY, tags.replaceAll(",", "--").replaceAll("\s", "")); } instrumentationCore.create(bundle); start(); }

@Override
public void onStart() {
    waitForIdleSync();
    instrumentationCore.start();
}`

CucumberOptions @CucumberOptions( features ="features", glue = {"sea.pits.cucumber.steps"}, format = {"preety", "html:/data/data/com.app.xxxx/cucumber-reports/html-report", "json:/data/data/com.app.xxxx/cucumber-reports/cucumber.json", "junit:/data/data/com.app.xxxx/cucumber-reports/cucumber.xml" }, tags = {"@login-scenarios"} ) class AllTestSuites { }

Steps ` @Given("^I see the Entrance or On Boarding page$") public void i_see_the_Entrance_or_On_Boarding_page() throws Throwable { // Write code here that turns the phrase above into concrete actions throw new PendingException(); }

@When("^I swipe entrance$")
public void i_swipe_entrance() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}

@Then("^I click skip button$")
public void i_click_skip_button() throws Throwable {
    // Write code here that turns the phrase above into concrete actions
    throw new PendingException();
}`

Feature File

Feature: Entrance Testing Espresso

@login-scenarios Scenario: Entrance Test Given I see the Entrance or On Boarding page When I swipe entrance Then I click skip button

sebaslogen commented 7 years ago

Hi,

I recommend that you download this project and run it as it is from Android Studio, then if that works, have this project and yours side by side to compare classes.

One difference I noticed is in you CucumberTestRunner's onCreate method, there is a call to start() at the end, maybe that is causing trouble. See this file for comparison.

BuddyArifin commented 7 years ago

Already solved my problem,

first my problem on my Gradle on :app My application id have different name with my package test, fix with change the "testApplicationId" using my package name. Instrument will include all test.

second I created custom rule for create hooks, but cucumber will give me exception if i not call directly @Rule.

third and onCreate() on CucumberTestRunner.

Thanks, for your help