jeudi 15 septembre 2016

Class has no public constructor TestCase(String name) or TestCase() while run my Cucumber scenario

I'm using Green Coffee library to run Cucumber scenarios in my instrumentation tests. I followed example provided by repo step-by-step, but here's the error:

junit.framework.AssertionFailedError: Class pi.survey.features.MembersFeatureTest has no public constructor TestCase(String name) or TestCase()

Here's my test's source code:

package pi.survey.features;

import android.support.test.rule.ActivityTestRule;

import com.mauriciotogneri.greencoffee.GreenCoffeeConfig;
import com.mauriciotogneri.greencoffee.GreenCoffeeTest;
import com.mauriciotogneri.greencoffee.Scenario;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.io.IOException;

import pi.survey.MainActivity;
import pi.survey.steps.memberSteps;

@RunWith(Parameterized.class)
public class MembersFeatureTest extends GreenCoffeeTest {
    @Rule
    public ActivityTestRule<MainActivity> activity = new ActivityTestRule<>(MainActivity.class);

    public MembersFeatureTest(Scenario scenario) {
        super(scenario);
    }



    @Parameterized.Parameters
    public static Iterable<Scenario> scenarios() throws IOException {
        return new GreenCoffeeConfig()
                .withFeatureFromAssets("assets/members.feature")
                .scenarios();
    }

    @Test
    public void test() {
        start(new memberSteps());
    }

}

And my members.feature

Feature: Inserting info to server



  Scenario: Invalid members
          When I introduce an invalid members
          And  I press the login button
          Then I see an error message saying 'Invalid members'

Aucun commentaire:

Enregistrer un commentaire