c# - How can I process a table without headers in SpecFlow? -


coming using gherkin in ruby, want see if specflow on c# .net option me. in ruby able process table has fields in first column , values in second, this:

then see summary of details in overview page | service           | taxi        | | arrival station   | middlebourg | | arrival vehicle   | sat12901    | | arrival date      | 27/06/2014  | | no of passengers  | 2           | 

within specflow can use techtalk.speclflow.table object has these functions:

  • createinstance : assumes "service" , "taxi" headings they're not.
  • createset : ignores first line , returns key/value pairs. not working.

of course work around here change layout of table match working of specflow's table object. there alternative, "rows_hash" function in ruby? thanks!

it seems specflow assumes header. can access header with:

table.header 

to raw access headings. collection of strings can access individual elements with:

var firstrowfirstcolumn = table.header[0]; var firstrowsecondcolumn = table.header[1];  

you can access remaining individual rows in table this:

foreach(var row in table.rows) {    var first = row[0];    var second = row[1];    ... use values ... } 

to of other values in table

if want raw access without headers create extension method this:

public static ienumerable<tablerow> allrows(this table table) {      yield return new tablerow(table, table.header);      foreach(var row in table.rows)      {          yield return row;      }  } 

i don't know if can create tablerow (it looks should possible source) , might have create own tablerow object wraps specflow tablerow should idea.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -