转置示例 table 黄瓜

Transpose examples table Cucumber

我想要完成的是使用我当前使用的示例 table 的转置版本,如下所示:

 | col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 | ...
 | ".." | ".." | ".." | ".." | ".." | ".." | ".." | ".." | ...
 | ".." | ".." | ".." | ".." | ".." | ".." | ".." | ".." | ...
 | ".." | ".." | ".." | ".." | ".." | ".." | ".." | ".." | ...

所以你可以看到,我们的列比行多得多,这使得必须左右滚动才能读取值。 我想这样说:

 | col1  | ".."| ".."| ".." |
 | col2  | ".."| ".."| ".." |
 | col3  | ".."| ".."| ".." |
 | col4  | ".."| ".."| ".." |
 | col5  | ".."| ".."| ".." |
 | col6  | ".."| ".."| ".." |
 | col7  | ".."| ".."| ".." |
 | col8  | ".."| ".."| ".." |
    .
    .
    .

有什么办法可以解决我的问题。 我必须提到我正在使用 Ruby 作为步骤定义和测试:

提前致谢

cucumber表有transpose的方法,可以按以下方式使用:

Given(/^I add the names$/) do |table|
  transposedTable = table.transpose
  @data = transposedTable.rows_hash

  add_names(@data)
end

http://www.rubydoc.info/gems/cucumber/1.3.17/Cucumber/Ast/Table#transpose-instance_method