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)
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
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)
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
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, ]
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
def step_verify_is_called_with_File_source_object(self): verify(File(self.file_path), self.sample_test)
def test_addition(self): """Addition feature.""" filename = Path(__file__).parent / "calculator.feature" verify(filename, self)
def test_comments(self): filename = features_dir / "comments.feature" verify(filename, self)
def test_docstrings(self): filename = features_dir / "docstrings.feature" verify(filename, self)
def test_labels(self): filename = features_dir / "labels.feature" verify(filename, self)
def test_fail_informatively_on_bad_scenario_regex(self): with self.assertRaises(InvalidScenarioMatchingPattern): verify(self.filename, self, scenario="\\")
def test_background(self): filename = features_dir / "background.feature" verify(filename, self)
def step_verify_is_called_with_Text_source_object(self): verify(Text(self.text), self.sample_test)
def step_verify_is_called_with_single_line_string_staring_with_http_or_https( self): verify(self.url, self.sample_test)
def step_verify_is_called_with_single_line_string_ending_in_feature(self): verify(self.file_path, self.sample_test)
def step_verify_is_called_with_feature_script(self): verify(self.text, self.sample_test)
def test_verify(self, requests): self.requests = requests feature_file = feature_dir / "verify.feature" verify(feature_file, self)
def step_verify_is_called_with_Url_source_object(self): verify(Url(self.url), self.sample_test)
def test_fizz_feature(self): verify('fizzbuzz.feature', self)
def test_addition(self): """Addition feature.""" verify(__doc__, self, scenario="Subsequent additions")
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