【问题标题】:Cucumber-jvm on android: running failed: No test results > Empty test suiteandroid上的Cucumber-jvm:运行失败:没有测试结果>空测试套件
【发布时间】:2014-10-23 08:08:38
【问题描述】:

我正在使用 cucumber-jvm 为 Android 应用程序开发测试。我写了一个特性和相应的步骤。控制台说有任何测试。

你是不是已经有这个问题了?

我不知道自己做错了什么。

运行测试测试运行开始测试运行失败:没有测试结果 空测试套件。

“StepsDefinitions.java”

@CucumberOptions(features = "features")


public class StepsDefinitions  extends ActivityInstrumentationTestCase2<LoginActivity> {
        public StepsDefinitions() {
            super(LoginActivity.class);
        assertNotNull(getActivity());
        Log.i("That","It is running.");
    }

    @Given("^I have a UserBox$")
    public void I_am_on_the_Login_Screen() {

        EditText etLoginUser =  (EditText) getActivity().findViewById(R.id.User);
        assertNotNull(etLoginUser);
    }
    @Then("^I should see on the display$")
    public void I_should_see_s_on_the_display() {
        EditText display = (EditText) getActivity().findViewById(R.id.Pass);

    } }

【问题讨论】:

    标签: android cucumber-jvm


    【解决方案1】:

    你有 Runner 课程吗?您只需要一个小的“标记”类来告诉 JUnit 调用 Cucumber 测试套件(将其放在与您的 StepDefinitions 相同的包中)。

    import cucumber.api.junit.Cucumber;
    import org.junit.runner.RunWith;
    
    @RunWith(Cucumber.class)
    public class RunCukesTest {
        // No further code needed
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-10
      • 2011-03-28
      • 2021-07-04
      相关资源
      最近更新 更多