Gauge 中Step使用别名

来源:互联网 发布:爱扑网络招聘 编辑:程序博客网 时间:2024/04/29 12:49

所有内容均来自Gauge官网文档


在执行的过程中,可能需要使用不同的名称来执行同样的操作,所以使用别名来区分


  • 在这个Scenario中,第一步和第三步是相同的操作,但是表示的方式不同
    User Creation    =============    Multiple Users    --------------    * Create a user "user 1"    * Verify "user 1" has access to dashboard    * Create another user "user 2"    * Verify "user 2" has access to dashboard
  • 使用别名即可解决这个问题:
    public class Users {        @Step({"Create a user <user_name>", "Create another user <user_name>"})        public void createUser(String user_name) {            // create user user_name        }    }

  • 在这个两个Scenario中,发送邮件的操作是相同的
    User Creation    -------------    * User creates a new account    * A "welcome" email is sent to the user    Shopping Cart    -------------    * User checks out the shopping cart    * Payment is successfully received    * An email confirming the "order" is sent
  • 使用别名:
    public class Users {        @Step({"A <email_type> email is sent to the user", "An email confirming the <email_type> is sent"})        public void sendEmail(String email_type) {            // Send email of email_type        }    }
0 0
原创粉丝点击