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_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_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_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_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_gets_itself_skipped_if_without_steps(self, FeatureTest): feature = FeatureTest() scenario = Scenario('Test scenario') scenario.run(feature) len(feature.method_calls) |should| be(1) feature.skipTest.assert_called_once_with('no steps defined')
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_gets_itself_skipped_if_without_steps(self, FeatureTest): feature = FeatureTest() scenario = Scenario('Test scenario') scenario.run(feature) len(feature.method_calls) | should | be(1) feature.skipTest.assert_called_once_with('no steps defined')