Java 在本文中,我们如何通过数据库传递示例关键字中的数据

Java 在本文中,我们如何通过数据库传递示例关键字中的数据,java,cucumber,cucumber-jvm,cucumber-serenity,Java,Cucumber,Cucumber Jvm,Cucumber Serenity,我想通过数据库传递example关键字中的数据,例如,我有一个场景: Scenario Outline: login with valid credential Given Enter "username" And Enter "password" When click on submit Then navigate on home page Examples: |username | password | |test1 | *****

我想通过数据库传递example关键字中的数据,例如,我有一个场景:

Scenario Outline: login with valid credential
    Given Enter "username"
    And Enter "password"
    When click on submit
    Then navigate on home page

Examples:
    |username | password |
    |test1    | *****    |
在示例关键字中,我想通过数据库传递数据,我们该怎么做请帮助我


提前感谢

如果将输入用户名和密码的步骤合并到一个步骤中,您可以查询数据库以填写密码:

When I log in as user "<username>"
当我以用户身份登录时“”
此步骤的定义应:

  • 为作为步骤参数传入的用户查询数据库
  • 在表单字段中键入用户名
  • 在表单字段中键入密码,您应该使用上面步骤1中的数据库查询获得该密码
  • 提交登录表单