何时在黄瓜jvm中使用场景场景参数

时间:2017-08-09 10:58:04

标签: cucumber cucumber-jvm cucumber-java

我搜索了确切的原因&使用场景场景参数(导入cucumber.api.Scenario;)的重要性,但没有明确答案。

https://github.com/cucumber/cucumber/wiki/Hooks> Scenario Hooks部分没有详细解释。

请提供实际的好处示例

1 个答案:

答案 0 :(得分:0)

您可以访问这些方法

enter image description here

利益取决于您的项目需求。试试看,看看你的项目在哪里可以提供帮助。

以下是一些例子:

def steepest_ascent_HCS(initial_state, objective_function): current_state = initial_state while True: current_state_value = objective_function(current_state) best_successor_state_value = float('inf') for successor_state in current_state.successor_states(): successor_state_value = objective_function(successor_state) if successor_state_value < best_successor_state_value: best_successor_state = successor_state best_successor_state_value = successor_state_value if best_successor_state_value >= current_state_value: return current_state, current_state_value current_state = best_successor_state 挂钩中获取方案名称,打印或保存以供其他用途(如报告):

@Before

@Before public void before(Scenario scenario) { String scenarioName = scenario.getName(); System.out.println("Scenario: " + scenarioName); } 挂钩中获取方案状态。

@After