def test_knows_number_of_defined_steps(self): @step('there is a step') def there_is_a_step(step): pass scenario = Scenario('Test scenario') scenario.add_step('Given', 'there is a step') scenario.step_count_defined |should| be(1)
def test_displays_pending_steps_in_skip_reason(self, FeatureTest): feature = FeatureTest() scenario = Scenario('Test scenario') scenario.add_step('Given', 'there is a step') scenario.run(feature) feature.skipTest.assert_called_once_with( 'pending 1 step(s): [<Given there is a step>]')
def test_knows_number_of_defined_steps(self): @step('there is a step') def there_is_a_step(step): pass scenario = Scenario('Test scenario') scenario.add_step('Given', 'there is a step') scenario.step_count_defined | should | be(1)
def test_can_be_created_from_outline_and_hash(self): outline = Scenario('Test outline') outline.add_step('Given', 'a value <value>') scenario = Scenario('Test scenario', outline=(outline, {'<value>': 'unique'})) scenario.step_count |should| be(1) step = scenario.steps[0] step.kind |should| be_equal_to('Given') step.text |should| be_equal_to('a value unique')
def test_can_run_step(self, FeatureTest): @step('there is a step') def there_is_a_step(step): self.run_count += 1 feature = FeatureTest() scenario = Scenario('Test scenario') scenario.add_step('Given', 'there is a step') self.run_count = 0 scenario.run(feature) self.run_count |should| be(1)
def test_can_run_step(self, FeatureTest): @step('there is a step') def there_is_a_step(step): self.run_count += 1 feature = FeatureTest() scenario = Scenario('Test scenario') scenario.add_step('Given', 'there is a step') self.run_count = 0 scenario.run(feature) self.run_count | should | be(1)
def test_can_be_created_from_outline_and_hash(self): outline = Scenario('Test outline') outline.add_step('Given', 'a value <value>') scenario = Scenario('Test scenario', outline=(outline, { '<value>': 'unique' })) scenario.step_count | should | be(1) step = scenario.steps[0] step.kind | should | be_equal_to('Given') step.text | should | be_equal_to('a value unique')
def test_can_run_steps(self, FeatureTest): @step('there is step ([0-9]+)') def there_is_step_number(step, number): steps_run.append(int(number)) feature = FeatureTest() scenario = Scenario('Test scenario') for i in range(3): scenario.add_step('Given', 'there is step %d' % i) steps_run = [] scenario.run(feature) steps_run |should| each_be_equal_to(range(3))
def test_can_run_steps(self, FeatureTest): @step('there is step ([0-9]+)') def there_is_step_number(step, number): steps_run.append(int(number)) feature = FeatureTest() scenario = Scenario('Test scenario') for i in range(3): scenario.add_step('Given', 'there is step %d' % i) steps_run = [] scenario.run(feature) steps_run | should | each_be_equal_to(range(3))
def test_stops_at_the_first_undefined_step(self, FeatureTest): @step('there is step ([0-9]+)') def there_is_step_number(step, number): steps_run.append(int(number)) feature = FeatureTest() scenario = Scenario('Test scenario') for i in range(3): scenario.add_step('Given', 'there is step %d' % i) scenario.add_step('And', 'there is an undefined step') scenario.add_step('Given', 'there is step %d' % 4) steps_run = [] scenario.run(feature) steps_run |should| each_be_equal_to(range(3))
def test_stops_at_the_first_undefined_step(self, FeatureTest): @step('there is step ([0-9]+)') def there_is_step_number(step, number): steps_run.append(int(number)) feature = FeatureTest() scenario = Scenario('Test scenario') for i in range(3): scenario.add_step('Given', 'there is step %d' % i) scenario.add_step('And', 'there is an undefined step') scenario.add_step('Given', 'there is step %d' % 4) steps_run = [] scenario.run(feature) steps_run | should | each_be_equal_to(range(3))
def test_displays_pending_steps_in_skip_reason(self, FeatureTest): feature = FeatureTest() scenario = Scenario('Test scenario') scenario.add_step('Given', 'there is a step') scenario.run(feature) feature.skipTest.assert_called_once_with('pending 1 step(s): [<Given there is a step>]')
def test_can_add_hashes_step(self): scenario = Scenario('Test scenario') scenario.add_step('Given', 'hashes', hashes=[dict(key='value')]) scenario.step_count |should| be(1) scenario.steps[0].hashes |should| be_equal_to([dict(key='value')])
def test_can_add_multiline_step(self): scenario = Scenario('Test scenario') scenario.add_step('Given', 'multiline', multilines=['line\n']) scenario.step_count |should| be(1) scenario.steps[0].multilines |should| be_equal_to(['line\n'])
def test_can_add_steps(self): scenario = Scenario('Test scenario') scenario.add_step('Given', 'there is a step') scenario.step_count | should | be(1)
def test_knows_number_of_undefined_steps(self): scenario = Scenario('Test scenario') scenario.add_step('Given', 'there is a step') scenario.step_count_undefined | should | be(1)
def test_knows_number_of_undefined_steps(self): scenario = Scenario('Test scenario') scenario.add_step('Given', 'there is a step') scenario.step_count_undefined |should| be(1)
def test_can_add_steps(self): scenario = Scenario('Test scenario') scenario.add_step('Given', 'there is a step') scenario.step_count |should| be(1)
def test_can_add_hashes_step(self): scenario = Scenario('Test scenario') scenario.add_step('Given', 'hashes', hashes=[dict(key='value')]) scenario.step_count | should | be(1) scenario.steps[0].hashes | should | be_equal_to([dict(key='value')])
def test_can_add_multiline_step(self): scenario = Scenario('Test scenario') scenario.add_step('Given', 'multiline', multilines=['line\n']) scenario.step_count | should | be(1) scenario.steps[0].multilines | should | be_equal_to(['line\n'])