我需要以下面的格式创建自定义报告(Excel)
专题|场景|步骤名称|状态|测试数据
计算器|添加|当我添加2和4 |通过| 2,4
计算器|添加|然后应该显示6 |通过| 6
为了达到这个目的,我需要从胶合的java步骤定义@When和@Then中提取完全合格的“步骤名称”。怎么做?
MyTest.feature
Feature: Calculator
Scenario: Add
Given that Calculator is ON
When i add 2 and 4
Then 6 should be displayed
@When("^i add (\\d+)(.*) and (\\d+) (.*)$")
public void calc_add(int a, int b){
//code here
//Need the entire string as i passed in .feature file
TestReport.log(stepName, assert(true));
}
@Then("^(\\d+) (.*) should be displayed$")
public void calc_add(int c){
//code here
//Need the entire string as i passed in .feature file
TestReport.log(stepName, assert(true));
}