简体   繁体   中英

How to call from two different example

I want to call both Desktop and Cloud Example. How can I do it. Here is my code

Scenario Outline: Test different value for same parameter
 Example: Desktop
 | app     | app1     |
 | instagram| facebook |

Example: Cloud
 | app     | app1     |
 | instagram| facebook |

Given <Desktop.app> And <Cloud.app> is installed on my device  # This gives me error
And <Desktop.app1> And <Cloud.app1> is installed on my device  # This gives me error  


@given("<app> is installed on my device")
def app_installation(app):
    install_app(app)

I am not sure what exactly you are trying to test here. As far as I understand you want to run two tests: one test for Desktop and a different test for Cloud. Your scenario outline is wrongly formatted, you should use the column name to reference the values in the table, try this code:

Scenario Outline: Test different value for same parameter
  Given instagram is installed on <system>
  And facebook is installed on <system>

Examples:
  | system  |
  | Desktop |
  | Cloud   |

Keep in mind, the number of test ran with scenario outlines matches the number of rows in the Examples table (here: 2). If you want to run 4 tests where you want to test all 4 combinations of system and app, use the following Examples table:

Examples:
  | system  | app       |
  | Desktop | facebook  |
  | Desktop | instagram |
  | Cloud   | facebook  |
  | Cloud   | instagram |

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM