pytest-bdd icon indicating copy to clipboard operation
pytest-bdd copied to clipboard

Example table not picked by scenario outline

Open ghost opened this issue 4 years ago • 7 comments

GOTO URL:

https://drive.google.com/drive/folders/1v3NOtvPeJm32QDrHnoCxKosgWjRUiTxD?usp=sharing

  1. download the folder
  2. Update the chrome driver as your browser and OS in the project dir
  3. come to feature file
  4. let it run like it is and see that the example table is picked with Type1
  5. Now uncomment the line which is commented
  6. issue: example table is not picked

ghost avatar Jan 07 '21 14:01 ghost

@youtux can you please guide here

ghost avatar Jan 07 '21 16:01 ghost

Please report the feature file content and explain what was expected to happen, and what happened instead. Sorry, but checking out projects is too time consuming.

youtux avatar Jan 07 '21 16:01 youtux

Feature: Attribute validation

Scenario Outline: Verify as a User I am able to set valid device attributes Given I login to application as a Monitor And Configuration page loads When I search for Required Device On Congiguration Page And I set the "min" value for all the attributes And I refresh the page And I select "User" in the Updated by field And I should see the "min" value for attributes for "User" "#" Then I refresh the page Then I wait for "15" minutes And I select "Device" in the Updated by field And I should see the "min" value for attributes for "Device" And I verify number of attribute not set

Examples:
  |sheetname  |
  |Type1      |
  |Type2      |
  |Type3      |
  |Type4      |
  |Type5      |
  |Type6      |
  |Type7      |
  |Type8      |
  |Type9      |

ghost avatar Jan 07 '21 16:01 ghost

@youtux I have given # in quotes bcz # becomes heading for github comment Issue: Here if i comment my feature file line "Then I refresh the page" which occurs second time then scenario outline picks the example table but if i uncomment the line "Then I refresh the page" which occurs second time then scenario outline do not picks the example data table

ghost avatar Jan 07 '21 16:01 ghost

step_def.py

from pytest_bdd import scenarios, given, when, then, scenario, parsers log_cli = True

login = None attribute = None device = None count = None

@scenario(feature_name='AttributeValidation.feature',scenario_name= 'Verify as a User I am able to set valid device attributes', features_base_dir='./Tests/Web/features/') def test_Verify_Attribute_value(browser): pass browser.quit()

@given("I login to application as a Monitor") def login_to_app(browser): print("login")

@when("I navigates to Devices page") def navigateToDevicePage(browser): print("navigateToDevicePage")

@given("Configuration page loads") def ConfigurationPageLoads(browser): print("ConfigurationPageLoads")

@when("I search for Required Device") def searchForRequiredDevice(browser): print("searchForRequiredDevice")

@when("I search for Required Device On Congiguration Page") def searchForRequiredDevice(browser): print("searchForRequiredDevice")

@when('I click on the attribute setting icon for the device') def clickOnConfigureAttributeSetting(browser): print("clickOnConfigureAttributeSetting")

@when('I should see the attribute configuration page') def verifyAttributePage(browser): print("verifyAttributePage")

@when(parsers.parse('I set the "{maxmin}" value for all the attributes')) def setAttributeValue(browser,maxmin,sheetname): print("setAttributeValue")

@when('I refresh the page') @then('I refresh the page') def refreshPage(browser): print("refreshPage")

@when(parsers.parse('I select "{user}" in the Updated by field')) @then(parsers.parse('I select "{user}" in the Updated by field')) def selectUpdatedBy(browser, user): print("selectUpdatedBy")

@when(parsers.parse('I should see the "{maxmin}" value for attributes for "{user}"')) def verifyValueForAllAttributesUser(browser,maxmin,sheetname,user): print("verifyValueForAllAttributesUser")

@then(parsers.parse('I should see the "{maxmin}" value for attributes for "{device}"')) def verifyValueForAllAttributesDevice(browser,maxmin,sheetname,device): print("verifyValueForAllAttributesDevice")

@when(parsers.parse('I wait for "{value}" minutes')) @then(parsers.parse('I wait for "{value}" minutes')) def waitTime(browser, value): print("waitTime")

@then("I verify number of attribute not set") def verifyCount(browser): print("verifyCount")

ghost avatar Jan 07 '21 16:01 ghost

@youtux updated the step def also plz have a look

ghost avatar Jan 07 '21 16:01 ghost

you can embed your code in triple quotes, so that it will be properly formatted. Checkout the Markdown documentation: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks#syntax-highlighting

youtux avatar Aug 19 '22 19:08 youtux