I tried to make test, but It fails. I'm not sure what that "#None" means. In tutorial everything worked. I'd be glad for help.
too_short_username_steps.feature
Feature: Username field
abc
Scenario: Too short Username
Given user is on last.fm registration website
When user fills in the username box with one character
Then User can see Your username should be between 2 and 15 characters, begin with a letter and contain only letters, numbers,
too_short_username_steps.py
from behave import given, when, then
@given('user is on last.fm register site')
def step_start_page(context):
context.driver.get('https://www.last.fm/join')
@when('user fills one character in username field')
def step_set_username(context):
context.driver.find_element_by_id('id_userName').send_keys('a')
@then('User can see ')
def step_valid_warning(context):
assert context.driver.find_element_by_css_selector("#mantle_skin > div.container.page-content > div > div > form > div.form-group.form-group--userName.js-form-group.has-error > div > div.js-form-group-error.form-group-error > div > p")
When i run "behave":
Feature: Username field # features/too_short_username.feature:1
dasdasd
Scenario: Too short Username # features/too_short_username.feature:3
Given user is on last.fm registration website # None
When user fills in the username box with one character # None
Then User can see Your username should be between 2 and 15 characters, begin with a letter and contain only letters, numbers, '_' or '-'. # None
Failing scenarios:
features/too_short_username.feature:3 Too short Username
0 features passed, 1 failed, 0 skipped
0 scenarios passed, 1 failed, 0 skipped
0 steps passed, 0 failed, 0 skipped, 3 undefined
Took 0m0.000s
You can implement step definitions for undefined steps with these snippets:
@given(u'user is on last.fm registration website')
def step_impl(context):
raise NotImplementedError(u'STEP: Given user is on last.fm registration website')
@when(u'user fills in the username box with one character')
def step_impl(context):
raise NotImplementedError(u'STEP: When user fills in the username box with one character')
@then(u'User can see Your username should be between 2 and 15 characters, begin with a letter and contain only letters, numbers, \'_\' or \'-\'.')
def step_impl(context):
raise NotImplementedError(u'STEP: Then User can see Your username should be between 2 and 15 characters, begin with a letter and contain only letters, numbers, \'_\' or \'-\'.')
Aucun commentaire:
Enregistrer un commentaire