I want to know if there is any way to convert a HashMap to a DataTable in java Cucumber. I tried doing some googling and saw that the reverse is possible. Any idea on how to implement this?
Thanks in advance.
Considering that
You could try:
List<List<String>> data = Arrays.asList(new ArrayList<String>(map.keySet()), new ArrayList<String>(map.values()));
DataTable dataTable = DataTable.create(data);
P.S. I have not tested the syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With