1

Instead of passing data from Examples: I want to pass the data from excel. as in that step I just want to compare expected and actual results for batch automation. I have 100s of test data to be tested for the same scenario. I could pass the test data from excel in Behave. But with PyTest BDD,I am not able to do it. I got the data from excel in a list. But in scenario, it is sending the whole list in first run itself. How can I iterate through the list and run the same scenario multiple times?

Scenario Outline: Browser Test

When I visit the URL <base>/<page>/<ordNumber>/<custName>

Then the browser contains test <custNumber>

Examples: 

 | base                         | page   | ordNumber | custName |

 | http://www.stackoverflow.com | orders | 123       | John     |

 | http://www.stackoverflow.com | orders | 456       | Mike     |

 | http://www.stackoverflow.com | orders | 789       | Tom      |
  • To read data from an external excel file for Scenario Outline, you need to use a library like pandas to read the data and then pass it to the scenario. You can find the documentation for pandas library, which is used to read the data from an excel file, here: [link](https://pandas.pydata.org/docs/) You can also find a detailed tutorial on how to read data from an excel file using pandas here: [link](https://datatofish.com/read_excel/) – Kylar Feb 11 '23 at 04:49
  • Thanks for your reply. I could read feom excel and get it in a list. But the problem is, I want the feature to run for each value in the list. But now it is not happening. How to write this data to Examples table? – Sara Ananth Feb 11 '23 at 10:47

0 Answers0