계측 테스트에서 오이 시나리오를 실행하려면 Green Coffee library을 사용하고 있습니다. 나는 REPO 단계별로 제공하는 예를 따라, 그러나 여기에서 오류 발생 :클래스에 public constructor가 없습니다. Cucumber 시나리오 실행 중 TestCase (String name) 또는 TestCase()가 있습니다.
junit.framework.AssertionFailedError: Class pi.survey.features.MembersFeatureTest has no public constructor TestCase(String name) or TestCase()
내가 provided here 같은 클래스에 기본 생성자를 추가하려고하면, 그것은
no default constructor available in 'com.mauriciotogneri.greencoffee.GreenCoffeeTest'
여기 내 테스트의 말한다 소스 코드 :
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());
}
}
그리고 내 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'
흥미 롭; 당신이 올바른지; GreenCoffeeTest는 생성자 만 시나리오를 사용합니다. 따라서 기본 생성자 또는 문자열을 취하는 ctor가있는 클래스로 확장하는 것은 불가능한 것처럼 보입니다. – GhostCat
예, [문제점] (https://github.com/mauriciotogneri/green-coffee/issues/1)을 만들었습니다. 그래서 GreenCoffeeTest 클래스는 기본 빈 생성자 또는 뭔가가 있어야합니까? – getsadzeg
잘 모르겠다. 내게는 그 두 가지 (GreenCoffee)와 코코는 단순히 지금처럼 서로 놀 수없는 것처럼 보인다. – GhostCat