Beispiel #1
0
 def test_feature_with_long_comment(self):
     # ERGO how to detect shadowed test cases??
     source = """Feature: The Sacred Giant Mosquito of the Andes
                #  at http://www.onagocag.com/nazbird.jpg
                     so pay no attention to the skeptics!"""
     with self.assertRaisesRegex(SyntaxError, "linefeed in comment"):
         verify(source, self)
Beispiel #2
0
 def test_executes_setup_teardown_pairs(self):
     source = """
         Feature: setUp/tearDown pairs
             Scenario: passing scenario
                 When step passes
                 And next step passes
             Scenario: failing scenario
                 When step fails
     """
     try:
         verify(source, self)
     except AssertionError:
         pass
     expected_sequence = [
         "setUpFeature",
         "setUpScenario",
         "setUpStep",
         "step passes",
         "tearDownStep",
         "setUpStep",
         "next step passes",
         "tearDownStep",
         "tearDownScenario",
         "setUpScenario",
         "setUpStep",
         "step fails",
         "tearDownStep",
         "tearDownScenario",
         "tearDownFeature",
     ]
     assert expected_sequence == self.executed
Beispiel #3
0
 def test_script_without_feature_defined(self):
     # TODO: allow for files which have at least one step defined
     source = "i be a newbie feature"
     with self.assertRaisesRegex(
         SyntaxError, "feature files must start with a Feature"
     ):
         verify(source, self)
Beispiel #4
0
 def test_another_two_dimensional_table(self):
     self.crunks = []
     self.zones = []
     scene = self.assemble_scene_table_source(
         "Step my milkshake brings all the boys to the yard\n")
     verify(scene, self)
     assert ["work", "mall", "jail", "work", "mall", "jail"] == self.crunks
     assert ["beach", "beach", "beach", "hotel", "hotel",
             "hotel"] == self.zones
Beispiel #5
0
 def test_two_dimensional_table(self):
     self.elements = []
     self.factions = []
     scene = self.assemble_short_scene_table()
     verify(scene, self)
     assert [["Pangolin", "Glyptodon"], ["Pangea", "Laurasia"]] == [
         self.factions,
         self.elements,
     ]
Beispiel #6
0
    def test_supports_languages_other_than_english(self):
        source = """# language: pl

            Właściwość: obsługa języków obcych
            Scenariusz: Dopasowuje kroki według języka
                Zakładając, że wykonany został krok przygotowujący
                Gdy wykonuję akcję
                Wtedy weryfikuję wynik
        """
        verify(source, self)
        assert ["given", "when", "then"] == self.executed
Beispiel #7
0
 def step_verify_is_called_with_File_source_object(self):
     verify(File(self.file_path), self.sample_test)
Beispiel #8
0
 def test_addition(self):
     """Addition feature."""
     filename = Path(__file__).parent / "calculator.feature"
     verify(filename, self)
Beispiel #9
0
 def test_comments(self):
     filename = features_dir / "comments.feature"
     verify(filename, self)
Beispiel #10
0
 def test_docstrings(self):
     filename = features_dir / "docstrings.feature"
     verify(filename, self)
Beispiel #11
0
 def test_labels(self):
     filename = features_dir / "labels.feature"
     verify(filename, self)
Beispiel #12
0
 def test_fail_informatively_on_bad_scenario_regex(self):
     with self.assertRaises(InvalidScenarioMatchingPattern):
         verify(self.filename, self, scenario="\\")
Beispiel #13
0
 def test_background(self):
     filename = features_dir / "background.feature"
     verify(filename, self)
Beispiel #14
0
 def step_verify_is_called_with_Text_source_object(self):
     verify(Text(self.text), self.sample_test)
Beispiel #15
0
 def step_verify_is_called_with_single_line_string_staring_with_http_or_https(
         self):
     verify(self.url, self.sample_test)
Beispiel #16
0
 def step_verify_is_called_with_single_line_string_ending_in_feature(self):
     verify(self.file_path, self.sample_test)
Beispiel #17
0
 def step_verify_is_called_with_feature_script(self):
     verify(self.text, self.sample_test)
Beispiel #18
0
 def test_verify(self, requests):
     self.requests = requests
     feature_file = feature_dir / "verify.feature"
     verify(feature_file, self)
Beispiel #19
0
 def step_verify_is_called_with_Url_source_object(self):
     verify(Url(self.url), self.sample_test)
Beispiel #20
0
 def test_fizz_feature(self):
     verify('fizzbuzz.feature', self)
Beispiel #21
0
 def test_addition(self):
     """Addition feature."""
     verify(__doc__, self, scenario="Subsequent additions")
Beispiel #22
0
 def test_should_only_run_matching_scenarios(self):
     matching_pattern = r"Scenario Matches [12]"
     verify(self.filename, self, scenario=matching_pattern)
     assert ["first", "fourth"] == self.executed