如何在功能文件中将sql结果集作为参数传递?

时间:2018-11-20 20:34:54

标签: eclipse cucumber bdd gherkin cucumber-java

这是我的功能文件,在该文件中,我通过使用SQL查询然后比较两个结果集来从DB1和DB2获取学生人数:

Scenario: Verify the student Count
    Given Log into DB1
    And Execute student count query in DB1
    Given Log into DB2
    And Execute student count query in DB2
    Then Compare DB1 and DB2 student Count
    And Close the DB

在步骤定义文件中,我将获取DB1和DB2结果,并将两个结果集作为参数传递给以下步骤定义方法:

public void Compare_DB1_and_DB2_student_Count(ResultSet DB1_count, ResultSet DB2_count ) throws Throwable {
         while (DB1_count.next()) {
             DB2_count.next();
                ResultSetMetaData metadata_count = DB1_count.getMetaData();
                int col_count = metadata_count.getColumnCount();
                for (int index = 1;index<=col_count;index++) {
                    if (!DB1.getObject(index).equals(DB2.getObject(index))) {
                        System.out.println("Test Fail");
                    }
                }
            }
         System.out.println("Test Pass");
    }

当我执行此命令时,它说Cucumber.runtime.CucumberException:Arity不匹配:带有模式[^ Compare_DB1_and_DB2_student_Count $]的声明带有2个参数。但是,小黄瓜步骤具有0个自变量[]。

有人可以告诉我如何在特征和步骤定义文件中传递结果集。

0 个答案:

没有答案