コード例 #1
0
ファイル: test_feature.py プロジェクト: htmue/python-wishes
    def test_can_run_feature_with_scenario_outline_with_background(self):
        @step('a (.*)')
        def a_something(step, value):
            my_world.run.append(value)

        feature = load_feature('''
        Feature: with multiline scenarnio
          Background: with placeholder
            Given a <placeholder>
          Scenario Outline: follows
            And a step
          Examples:
            | <placeholder> |
            | first         |
            | second        |
        ''')
        my_world = World()
        my_world.run = []
        result = unittest.TestResult()

        feature.run(result)

        result.testsRun | should | be(2)
        result.wasSuccessful() | should | be(True)
        my_world.run | should | each_be_equal_to([
            'first',
            'step',
            'second',
            'step',
        ])
コード例 #2
0
ファイル: test_feature.py プロジェクト: htmue/python-wishes
    def test_can_run_feature_with_scenario_outline_with_multiline(self):
        @step('a multiline')
        def a_multiline(step):
            my_world.run.append(step.multiline)

        feature = load_feature('''
        Feature: with multiline scenarnio
          Scenario Outline: follows
            Given a multiline
              """
              with <placeholder>
              """
          Examples:
            | <placeholder> |
            | first         |
            | second        |
        ''')
        my_world = World()
        my_world.run = []
        result = unittest.TestResult()

        feature.run(result)

        result.testsRun | should | be(2)
        result.wasSuccessful() | should | be(True)
        my_world.run | should | each_be_equal_to([
            'with first\n',
            'with second\n',
        ])
コード例 #3
0
ファイル: test_feature.py プロジェクト: htmue/python-wishes
    def test_can_run_feature_with_scenario_outline_with_hashes(self):
        @step('a hash')
        def a_hash(step):
            my_world.run.append(list(step.hashes))

        feature = load_feature('''
        Feature: with multiline scenarnio
          Scenario Outline: follows
            Given a hash
              | <key>   | value         |
              | the     | <placeholder> |
          Examples:
            | <key> | <placeholder> |
            | key   | first         |
            | but   | second        |
        ''')
        my_world = World()
        my_world.run = []
        result = unittest.TestResult()

        feature.run(result)

        result.testsRun | should | be(2)
        result.wasSuccessful() | should | be(True)
        my_world.run | should | each_be_equal_to([
            [dict(key='the', value='first')],
            [dict(but='the', value='second')],
        ])
コード例 #4
0
ファイル: test_feature.py プロジェクト: htmue/python-wishes
    def test_can_run_feature_with_scenario_outline_and_examples(self):
        @step('a (.*) with (.*)')
        def a_key_with_value(step, key, value):
            my_world.run.append((key, value))

        feature = load_feature('''
        Feature: with multiline scenarnio
          Scenario Outline: follows
            Given a <key> with <value>
          Examples:
            | key   | value     |
            | key 1 | value 1   |
            | key 2 | value 2   |
        ''')
        my_world = World()
        my_world.run = []
        result = unittest.TestResult()

        feature.run(result)

        result.testsRun | should | be(2)
        result.wasSuccessful() | should | be(True)
        my_world.run | should | each_be_equal_to([
            ('key 1', 'value 1'),
            ('key 2', 'value 2'),
        ])
コード例 #5
0
ファイル: test_feature.py プロジェクト: htmue/python-wishes
 def test_can_run_feature_with_scenario_outline_with_background(self):
     @step('a (.*)')
     def a_something(step, value):
         my_world.run.append(value)
     feature = load_feature('''
     Feature: with multiline scenarnio
       Background: with placeholder
         Given a <placeholder>
       Scenario Outline: follows
         And a step
       Examples:
         | <placeholder> |
         | first         |
         | second        |
     ''')
     my_world = World()
     my_world.run = []
     result = unittest.TestResult()
     
     feature.run(result)
     
     result.testsRun |should| be(2)
     result.wasSuccessful() |should| be(True)
     my_world.run |should| each_be_equal_to([
         'first', 'step', 'second', 'step',
     ])
コード例 #6
0
ファイル: test_feature.py プロジェクト: htmue/python-wishes
 def test_can_run_feature_with_scenario_outline_with_hashes(self):
     @step('a hash')
     def a_hash(step):
         my_world.run.append(list(step.hashes))
     feature = load_feature('''
     Feature: with multiline scenarnio
       Scenario Outline: follows
         Given a hash
           | <key>   | value         |
           | the     | <placeholder> |
       Examples:
         | <key> | <placeholder> |
         | key   | first         |
         | but   | second        |
     ''')
     my_world = World()
     my_world.run = []
     result = unittest.TestResult()
     
     feature.run(result)
     
     result.testsRun |should| be(2)
     result.wasSuccessful() |should| be(True)
     my_world.run |should| each_be_equal_to([
         [dict(key='the', value='first')],
         [dict(but='the', value='second')],
     ])
コード例 #7
0
ファイル: test_feature.py プロジェクト: htmue/python-wishes
 def test_can_run_feature_with_scenario_outline_with_multiline(self):
     @step('a multiline')
     def a_multiline(step):
         my_world.run.append(step.multiline)
     feature = load_feature('''
     Feature: with multiline scenarnio
       Scenario Outline: follows
         Given a multiline
           """
           with <placeholder>
           """
       Examples:
         | <placeholder> |
         | first         |
         | second        |
     ''')
     my_world = World()
     my_world.run = []
     result = unittest.TestResult()
     
     feature.run(result)
     
     result.testsRun |should| be(2)
     result.wasSuccessful() |should| be(True)
     my_world.run |should| each_be_equal_to([
         'with first\n',
         'with second\n',
     ])
コード例 #8
0
ファイル: test_feature.py プロジェクト: htmue/python-wishes
 def test_can_run_feature_with_scenario_outline_and_examples(self):
     @step('a (.*) with (.*)')
     def a_key_with_value(step, key, value):
         my_world.run.append((key, value))
     feature = load_feature('''
     Feature: with multiline scenarnio
       Scenario Outline: follows
         Given a <key> with <value>
       Examples:
         | key   | value     |
         | key 1 | value 1   |
         | key 2 | value 2   |
     ''')
     my_world = World()
     my_world.run = []
     result = unittest.TestResult()
     
     feature.run(result)
     
     result.testsRun |should| be(2)
     result.wasSuccessful() |should| be(True)
     my_world.run |should| each_be_equal_to([
         ('key 1', 'value 1'),
         ('key 2', 'value 2'),
     ])