Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个控制器,它定义了要在视图中显示的 @projects 变量。
有什么方法可以在黄瓜步骤中访问该项目?请注意,此变量包含分页结果,其目的是测试值是否显示在页面中。
我试图通过分配和控制器访问变量,但它们都是空的。
谢谢。
您通常在 Cucumber 中处理此问题的方式是直接测试输出。
所以:
您不需要从 Cucumber 功能访问控制器变量,因为 Cucumber 旨在模拟您的用户在您的站点上的体验,并且用户也不能直接访问控制器。