getsadzeg getsadzeg - 4 years ago 166
Android Question

Class has no public constructor TestCase(String name) or TestCase() while running 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()

And when I try to add default constructor to the class like provided here, it says

no default constructor available in

Here's my test's source code:

package pi.survey.features;


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 pi.survey.MainActivity;
import pi.survey.steps.memberSteps;

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

public MembersFeatureTest(Scenario scenario) {

public static Iterable<Scenario> scenarios() throws IOException {
return new GreenCoffeeConfig()

public void test() {
start(new memberSteps());


And my

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'

Answer Source

Solved problem by just fixing the structure.

code details in this commit

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download